<template>
  <pageTabelLayout>
    <template #pageHeader>
      <div class="search-form divClass" v-if="headerShow">
        <div>
          <a-form size="small" :model="pageData" layout="inline" label-align="right">
            <CorporateSectorCascader
              :style="{ width: '200px' }"
              :configCascader="configCascader"
              @changeCascader="changeCascader"
            />
            <a-form-item label="仓库" :style="{ width: '300px' }" label-col-flex="65px">
              <a-select
                popup-container="html"
                class="bacClass"
                placeholder=""
                v-model="searchData.wh"
                allow-clear
              >
                <a-option v-for="item in whList" :value="item.id">
                  {{ item.warehouseName }}
                </a-option>
              </a-select>
            </a-form-item>
            <a-form-item label="原料编号" :style="{ width: '300px' }" label-col-flex="100px">
              <a-input allow-clear class="bacClass" v-model="pageData.yarnCode" />
            </a-form-item>
            <a-form-item label="原料名称" :style="{ width: '300px' }" label-col-flex="100px">
              <a-input allow-clear class="bacClass" v-model="pageData.yarnName" />
            </a-form-item>
            <a-form-item label="纱牌" :style="{ width: '300px' }" label-col-flex="65px">
              <a-input allow-clear class="bacClass" v-model="pageData.yarnBrand" />
            </a-form-item>
            <a-form-item label="纱批" :style="{ width: '262px' }" label-col-flex="65px">
              <a-input allow-clear class="bacClass" v-model="pageData.productionBatch" />
            </a-form-item>
            <a-form-item label="等级" :style="{ width: '300px' }" label-col-flex="65px">
              <a-input allow-clear class="bacClass" v-model="pageData.level" />
            </a-form-item>
            <a-form-item
              v-if="isIDs == 4"
              label="出库单号"
              :style="{ width: '300px' }"
              label-col-flex="65px"
            >
              <a-input allow-clear class="bacClass" v-model="pageData.outStockNumber" />
            </a-form-item>
            <a-form-item
              label="日期"
              v-if="isIDs == 2"
              :style="{ width: '300px' }"
              label-col-flex="100px"
            >
              <a-date-picker
                popup-container="html"
                :style="{ width: '229px' }"
                class="bacClass"
                v-model="pageData.startDate"
              />
            </a-form-item>
            <a-form-item
              label="至"
              v-if="isIDs == 2"
              :style="{ width: '300px' }"
              label-col-flex="100px"
            >
              <a-date-picker
                popup-container="html"
                :style="{ width: '229px' }"
                class="bacClass"
                v-model="pageData.endDate"
              />
            </a-form-item>
            <a-form-item
              label="拆纱单打印状态"
              v-if="isIDs == 2"
              :style="{ width: '300px' }"
              label-col-flex="110px"
            >
              <a-select
                popup-container="html"
                class="bacClass"
                placeholder=""
                v-model="pageData.disPrintState"
              >
                <a-option :value="0">未打印</a-option>
                <a-option :value="1">已打印</a-option>
                <a-option :value="2">全部</a-option>
              </a-select>
            </a-form-item>
            <a-form-item
              label="拆纱单类型"
              v-if="isIDs == 2"
              :style="{ width: '262px' }"
              label-col-flex="80px"
            >
              <a-select
                popup-container="html"
                class="bacClass"
                placeholder=""
                v-model="pageData.orderType"
              >
                <a-option :value="0">拆纱单</a-option>
                <a-option :value="1">发纱单</a-option>
                <a-option :value="2">全部</a-option>
              </a-select>
            </a-form-item>
          </a-form>
        </div>
      </div>
      <div class="my-tool-bar">
        <Toolbar
          v-if="isIDs == 1"
          :items="pageData.btnList"
          @select="selectHandler"
          @cjcsd="cjcsds"
        >
        </Toolbar>
        <Toolbar
          v-else-if="isIDs == 2"
          :items="pageData.btnList1"
          @select="selectHandler1"
          @dycsd="dycsds"
          @dysf="dysfs"
          @bdsf="bdsfs"
          @export="exports"
        >
        </Toolbar>
        <Toolbar
          v-else-if="isIDs == 3"
          :items="pageData.btnList2"
          @select="selectHandler2"
          @ktktk="ktktks"
        >
        </Toolbar>
        <Toolbar v-else :items="pageData.btnList3" @select="selectHandler3"> </Toolbar>
      </div>
      <div class="my-divisders">
        <a-divider orientation="center">
          <icon-double-up
            v-if="headerShow"
            @click="headerShow = false"
            :strokeWidth="2"
            :size="18"
          />
          <icon-double-down v-else @click="headerShow = true" :strokeWidth="2" :size="18" />
        </a-divider>
      </div>
    </template>
    <template #pageTabel>
      <!-- <a-space style="float: right; z-index: 9999"></a-space> -->
      <a-tabs :lazy-load="true" :justify="true" @change="changeTabs">
        <a-tab-pane title="待处理" :key="1">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReady"
              @columnVisible="onColumnVisible"
              @columnResized="onColumnResized"
              @columnMoved="onColumnMoved"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="table.dataList"
              :columnDefs="tc1"
              :localeText="localeText1"
            >
            </AgGridVuesCopys>
            <paginationCopys
              v-if="isIDs == 1"
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center"
              :page-size="pagination.pageSize"
              :current="pagination.page"
              :page-size-options="pagingList1"
            />
          </a-spin>
        </a-tab-pane>
        <a-tab-pane title="已处理" :key="2">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReady2"
              @columnResized="onColumnResized2"
              @columnMoved="onColumnMoved2"
              @columnVisible="onColumnVisible2"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="table.dataList"
              :columnDefs="tc2"
              :localeText="localeText1"
            >
            </AgGridVuesCopys>
            <paginationCopys
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center"
              :page-size="pagination2.pageSize"
              :current="pagination2.page"
              :page-size-options="pagingList1"
            />
          </a-spin>
        </a-tab-pane>
        <a-tab-pane title="可退库" :key="3">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReady3"
              @columnVisible="onColumnVisible3"
              @columnResized="onColumnResized3"
              @columnMoved="onColumnMoved3"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="table.dataList"
              :columnDefs="tc3"
              :localeText="localeText1"
            >
            </AgGridVuesCopys>
            <paginationCopys
              v-if="isIDs == 3"
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center"
              :page-size="pagination3.pageSize"
              :current="pagination3.page"
              :page-size-options="pagingList1"
            />
          </a-spin>
        </a-tab-pane>
        <a-tab-pane title="退库记录" :key="4">
          <a-spin
            :loading="pageData.pageLoading"
            tip="加载中"
            dot
            style="height: 100%; width: 100%; z-index: 999"
          >
            <AgGridVuesCopys
              :rowHeight="33"
              :headerHeight="33"
              :suppressCopyRowsToClipboard="true"
              :suppressDragLeaveHidesColumns="true"
              rowSelection="multiple"
              @grid-ready="gridReady4"
              @columnVisible="onColumnVisible4"
              @columnResized="onColumnResized4"
              @columnMoved="onColumnMoved4"
              style="height: calc(100% - 45px)"
              :defaultColDef="defaultColDef"
              class="ag-theme-alpine"
              :rowData="table.dataList"
              :columnDefs="tc4"
              :localeText="localeText1"
            >
            </AgGridVuesCopys>
            <paginationCopys
              v-if="isIDs == 4"
              :total="total"
              show-total
              show-jumper
              show-page-size
              @change="PageSize"
              @page-size-change="change1"
              style="justify-content: center"
              :page-size="pagination4.pageSize"
              :current="pagination4.page"
              :page-size-options="pagingList1"
            />
          </a-spin>
        </a-tab-pane>
      </a-tabs>
    </template>

    <a-drawer
      style="z-index: 999"
      ok-text="保存"
      cancel-text="关闭"
      :drawer-style="{ zIndex: 999 }"
      :mask-closable="false"
      :width="400"
      unmount-on-close
      popup-container=".arco-tabs-content"
      height="100%"
      :visible="pageData.showAdd_cjcsd"
      :ok-loading="pageData.pageLoading"
      placement="bottom"
      @ok="sideOk"
      @cancel="pageData.showAdd_cjcsd = false"
    >
      <template #title> 新建拆纱单</template>
      <div
        style="padding: 0px; box-sizing: border-box; min-width: 100%; overflow: auto"
        class="scrollbar"
      >
        <el-scrollbar>
          <a-tabs :lazy-load="true" default-active-key="1">
            <a-tab-pane key="1" title="基本信息">
              <div>
                <a-form
                  ref="formRef"
                  :model="dataForm"
                  size="small"
                  layout="horizontal"
                  :label-col-props="{ span: 10 }"
                  :wrapper-col-props="{ span: 14 }"
                >
                  <a-space size="large">
                    <div>
                      <a-space>
                        <a-form-item
                          label="公司"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.firm" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="仓库名称"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.warehouse" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="原料编号"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.yarnCode" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="原料名称"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.yarnName" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="色号"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.colorCode" class="bacClass" />
                        </a-form-item>
                      </a-space>
                      <a-space>
                        <a-form-item
                          label="色称"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.colorName" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="纱牌"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input v-model="dataForm.yarnBrand" disabled class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="纱批"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input v-model="dataForm.productionBatch" disabled class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="整件/件重"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.pieceWeight" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="整件/件数"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.pieceNumber" class="bacClass" />
                        </a-form-item>
                      </a-space>
                      <a-space>
                        <a-form-item
                          label="整件/总重量"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.weightPieceTotal" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="散件/件数"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.bulkNumber" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="散件/个数"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.bulkCount" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="散件/散重"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.bulkWeight" class="bacClass" />
                        </a-form-item>
                        <a-form-item
                          label="总重量"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-input disabled v-model="dataForm.weightTotal" class="bacClass" />
                        </a-form-item>
                      </a-space>
                      <a-space>
                        <a-form-item
                          label="拆纱单类型"
                          :style="{ width: '300px' }"
                          label-col-flex="100px"
                        >
                          <a-select
                            popup-container="html"
                            class="bacClass"
                            placeholder=""
                            v-model="dataForm.orderType"
                            allow-clear
                          >
                            <a-option :value="0">拆纱单</a-option>
                            <a-option :value="1">发纱单</a-option>
                          </a-select>
                        </a-form-item>
                      </a-space>
                    </div>
                  </a-space>
                </a-form>
              </div>
              <div>
                <div
                  class="arco-tabs arco-tabs-horizontal arco-tabs-top arco-tabs-type-line arco-tabs-size-medium arco-tabs-justify"
                  data-v-3f9c3d16=""
                  ><!---->
                  <div
                    class="arco-tabs-nav arco-tabs-nav-horizontal arco-tabs-nav-top arco-tabs-nav-size-medium arco-tabs-nav-type-line"
                  >
                    <!---->
                    <div class="arco-tabs-nav-tab">
                      <div
                        class="arco-tabs-nav-tab-list"
                        style="transform: translateX(0px); opacity: 0"
                      >
                        <div tabindex="0" class="arco-tabs-tab arco-tabs-tab-active"
                          ><span class="arco-tabs-tab-title"></span
                          ><!--v-if--></div
                        >
                        <div class="arco-tabs-nav-ink" style="left: 16px; width: 8px"></div> </div
                      ><!----> </div
                    ><!---->
                    <div class="arco-tabs-nav-extra"><!----><!----></div>
                  </div>
                  <div class="arco-tabs-content">
                    <a-button type="primary" style="margin-bottom: 10px" @click="DeleteClick"
                      >删除</a-button
                    >
                    <AgGridVuesCopys
                      :rowHeight="33"
                      :headerHeight="33"
                      :suppressCopyRowsToClipboard="true"
                      :suppressDragLeaveHidesColumns="true"
                      rowSelection="multiple"
                      @grid-ready="gridReadyAdd"
                      style="height: 300px"
                      :defaultColDef="defaultColDef"
                      class="ag-theme-alpine"
                      :rowData="pageData.cfList"
                      :columnDefs="tableColumnsCf"
                      :localeText="localeText1"
                    >
                    </AgGridVuesCopys>
                  </div>
                </div>
              </div>
            </a-tab-pane>
          </a-tabs>
        </el-scrollbar>
      </div>
    </a-drawer>
    <a-drawer
      style="z-index: 999"
      ok-text="退库"
      cancel-text="取消"
      :drawer-style="{ zIndex: 999 }"
      :mask-closable="false"
      :width="400"
      unmount-on-close
      popup-container=".arco-tabs-content"
      height="100%"
      :visible="pageData.show_csdtk"
      :ok-loading="pageData.pageLoading"
      placement="bottom"
      @ok="stockDrawOk"
      @cancel="pageData.show_csdtk = false"
    >
      <template #title> 拆纱单退库</template>
      <encapsulation-agrid ref="gridOptionRef2" :configaggrid="configaggrid2"></encapsulation-agrid>
    </a-drawer>
    <el-dialog v-model="visiblecg" title="拆纱单" width="810">
      <div id="jitdy">
        <template v-for="(item, index) in printList" :key="index">
          <div class="print-content">
            <div class="printTitle" style="color: #000">
              <div style="font-size: 28px; font-weight: 700">{{ item.company }}</div>
              <div style="font-size: 18px; font-weight: 700"
                >{{ item.orderType }}号：{{ item.disassembleCode }}</div
              >
            </div>
            <QrcodeVue
              :value="item.file"
              style="position: absolute; top: 0px; right: 0px"
            ></QrcodeVue>
            <div class="contentPrint">
              <div class="printLeft">
                <div class="title-text" style="font-size: 16px; font-weight: 600">{{
                  item.printTime
                }}</div>
                <div class="title-text" style="font-size: 13px"
                  >原料名称：{{ item.rawmaterialName }}</div
                >
              </div>

              <div class="printCenter">
                <div class="title-text">客户：{{ item.customName }}</div>
                <div class="title-text">单据类型：{{ item.orderType }}</div>
              </div>

              <div class="printRight">
                <div class="title-text">纱牌：{{ item.brandName }}</div>
                <div class="title-text">纱批：{{ item.yarnBatch }}</div>
              </div>
            </div>

            <div class="tablePrint">
              <table cellspacing="0" width="49.5%">
                <tr>
                  <td class="tableTrtd" style="font-weight: 600">机台号</td>
                  <td class="tableTrtd" style="font-weight: 600">整件</td>
                  <td class="tableTrtd" style="font-weight: 600">件重</td>
                  <td class="tableTrtd" style="font-weight: 600">散件</td>
                  <td class="tableTrtd" style="font-weight: 600">散重</td>
                  <td class="tableTrtd" style="font-weight: 600">箱数</td>
                  <td class="tableTrtd" style="font-weight: 600">备注</td>
                </tr>
                <tr v-for="(item1, index1) in item.detail.oneDetail" :key="index1">
                  <td class="tableTrtd">{{ item1.machineCode }}</td>
                  <td class="tableTrtd">{{ item1.disassemblePieceNum }}</td>
                  <td class="tableTrtd">{{ item1.pieceWeight }}</td>
                  <td class="tableTrtd">{{ item1.disassembleBulkNumber }}</td>
                  <td class="tableTrtd">{{ item1.disassembleBulkWeight }}</td>
                  <td class="tableTrtd">{{ item1.caseNumber }}</td>
                  <td class="tableTrtd">{{ item1.needRemark }}</td>
                </tr>
              </table>

              <table cellspacing="0" width="49.5%">
                <tr>
                  <td class="tableTrtd" style="font-weight: 600">机台号</td>
                  <td class="tableTrtd" style="font-weight: 600">整件</td>
                  <td class="tableTrtd" style="font-weight: 600">件重</td>
                  <td class="tableTrtd" style="font-weight: 600">散件</td>
                  <td class="tableTrtd" style="font-weight: 600">散重</td>
                  <td class="tableTrtd" style="font-weight: 600">箱数</td>
                  <td class="tableTrtd" style="font-weight: 600">备注</td>
                </tr>
                <tr v-for="(item1, index1) in item.detail.twoDetail" :key="index1">
                  <td class="tableTrtd">{{ item1.machineCode }}</td>
                  <td class="tableTrtd">{{ item1.disassemblePieceNum }}</td>
                  <td class="tableTrtd">{{ item1.pieceWeight }}</td>
                  <td class="tableTrtd">{{ item1.disassembleBulkNumber }}</td>
                  <td class="tableTrtd">{{ item1.disassembleBulkWeight }}</td>
                  <td class="tableTrtd">{{ item1.caseNumber }}</td>
                  <td class="tableTrtd">{{ item1.needRemark }}</td>
                </tr>
              </table>

              <table cellspacing="0" style="margin-top: 20px" width="100%">
                <tr>
                  <td style="border-top: none; width: 50px; height: 30px" class="textAlign"
                    >汇总</td
                  >
                  <td style="border-top: none; height: 30px" class="textAlign">{{
                    item.numberTotal
                  }}</td>
                  <td style="border-top: none; height: 30px" class="textAlign">{{
                    item.caseNumberTotal
                  }}</td>
                  <td style="border-top: none; width: 50px; height: 30px" class="textAlign"
                    >汇总</td
                  >
                  <td style="border-top: none; height: 30px" class="textAlign">{{
                    item.disassembleWeightTotal
                  }}</td>
                </tr>
              </table>
            </div>

            <div class="footerPrint">
              <div class="printw" style="margin-left: -70px">制单人： {{ item.printName }}</div>
              <div class="printw">复核：</div>
              <div class="printw" style="margin-left: -20px">拆纱工签名：</div>
            </div>
          </div>
          <div class="page-break"></div>
        </template>
      </div>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="pirintSplitSheet"> 打印 </el-button>
        </span>
      </template>
    </el-dialog>
    <a-modal v-model:visible="visiblecg1" ok-text="打印" @ok="print1" :width="800">
      <template #title>{{ pageData.titleOPen }}</template>
      <div style="height: 600px; overflow: auto">
        <div id="dyy2">
          <div
            v-for="(item, key, index) in idDtaDys1"
            :key="index"
            style="width: 215.433071px; height: 650px; margin-top: 20px"
          >
            <div class="divNev"></div>
            <table class="isTable2">
              <tr>
                <td colspan="4">{{ item.company }}</td>
              </tr>
              <tr>
                <td style="height: 40px">单号</td>
                <td colspan="2" style="font-size: 12px">{{ item.planOrderCode }}</td>
                <td style="font-size: 12px">{{ item.printTime }}</td>
              </tr>
              <tr>
                <td style="height: 70px">原料名称</td>
                <td colspan="3" style="font-size: 12px">{{ item.rawmaterialName }}</td>
              </tr>
              <tr>
                <td style="height: 45px">色号色称</td>
                <td colspan="3" style="font-size: 12px"
                  >{{ item.colorCode }}/{{ item.colorName }}</td
                >
              </tr>
              <tr>
                <td style="height: 30px">品牌</td>
                <td colspan="3" style="font-size: 12px">{{ item.brandName }}</td>
              </tr>
              <tr>
                <td style="height: 45px">批次</td>
                <td colspan="3" style="font-size: 12px">{{ item.yarnBatch }}</td>
              </tr>
              <tr>
                <td style="height: 45px; width: 45px">位置</td>
                <td style="font-size: 12px; width: 63px">{{ item.coordinate }}</td>
                <td style="height: 45px; width: 45px"><b>机台</b></td>
                <td style="font-size: 12px; width: 63px; font-size: 18px; font-weight: 800">{{
                  item.machineCode
                }}</td>
              </tr>
            </table>
            <h3 style="margin-left: 10px"
              >楼层: <span>{{ item.areaName }}</span></h3
            >
            <h3 style="margin-left: 10px"
              >纱飞单号: <span>{{ item.disassembleCode }}</span></h3
            >
            <h3 style="margin-left: 10px"
              >机位序号: <span>{{ item.coordinate }}#{{ item.ls }}</span></h3
            >
            <h3 style="margin-left: 10px"
              >备注: <span>{{ item.needRemark }}</span></h3
            >
            <h2 style="text-align: center">巨丰</h2>
            <div class="divTop"></div>
          </div>
        </div>
      </div>
    </a-modal>
    <!-- <a-modal v-model:visible="visiblecg3" ok-text="打印" @ok="print1" :width="800"> -->
    <a-modal v-model:visible="visiblecg3" ok-text="打印" @ok="print" :width="800">
      <template #title> 巨丰 纱飞</template>
      <div id="dyy3">
        <!-- <h1 style="text-align: center; font-size: 30px"><b>织造一厂</b></h1>
          <table class="isTable1" v-for="(item, key, index) in idDtaDys1" :key="index">
            <tr>
              <th>打印人</th>
              <td>{{ item.printName }}</td>
              <th>打印时间</th>
              <td>{{ item.printTime }}</td>
            </tr>
            <tr>
              <th>计划单号</th>
              <td>{{ item.planOrderCode }}</td>
              <th>需求单号</th>
              <td>{{ item.planNeedCode }}</td>
            </tr>
            <tr>
              <th>拆纱单号</th>
              <td>{{ item.disassembleCode }}</td>
              <th>原料编码</th>
              <td>{{ item.rawmaterialCode }}</td>
            </tr>
            <tr>
              <th>原料名称</th>
              <td>{{ item.rawmaterialName }}</td>
              <th>纱牌</th>
              <td>{{ item.brandName }}</td>
            </tr>
            <tr>
              <th>色号/色称</th>
              <td>{{ item.colorCode }}/{{ item.colorName }}</td>
              <th>纱批</th>
              <td>{{ item.yarnBatch }}</td>
            </tr>
            <tr>
              <th>机台号</th>
              <td>{{ item.machineCode }}</td>
              <th>流水号</th>
              <td>{{ item.ls }}</td>
            </tr>
                              </table> -->
        <div class="divTop"></div>
        <div class="divNev"></div>
        <div class="divBody">
          <table class="isTable2">
            <tr>
              <td colspan="4">织造三厂</td>
            </tr>
            <tr>
              <td>单号</td>
              <td colspan="2">CS320308738</td>
              <td>03-31</td>
            </tr>
            <tr>
              <td style="height: 80px">品名</td>
              <td colspan="3">26s/1金属棉紧密纺</td>
            </tr>
            <tr>
              <td style="height: 50px">色号色称</td>
              <td colspan="3">/</td>
            </tr>
            <tr>
              <td>品牌</td>
              <td colspan="3">巨丰</td>
            </tr>
            <tr>
              <td>批号</td>
              <td colspan="3">HS2623-1-1</td>
            </tr>
            <tr>
              <td>机位号</td>
              <td>C027</td>
              <td>机号</td>
              <td>363</td>
            </tr>
          </table>
          <h3>纱飞单号：<span>CS320308738</span></h3>
          <h3>机位序号：<span>C027#2</span></h3>
          <center>巨丰</center>
        </div>
      </div>
    </a-modal>
    <a-modal v-model:visible="visiblecg5" ok-text="确定" @ok="prints2" :width="800">
      <template #title> 补打纱飞</template>
      <div id="dyy4">
        <table class="isTable">
          <tr>
            <th>计划单号</th>
            <th>原料编号</th>
            <th>机台号</th>
            <th>需求单号</th>
            <th>补打张次</th>
          </tr>
          <tr v-for="(item, key, index) in idDtaDys3" :key="index">
            <td>{{ item['planOrderCode'] }}</td>
            <td>{{ item['rawmaterialCode'] }}</td>
            <td>{{ item['machineCode'] }}</td>
            <td>{{ item['planNeedCode'] }}</td>
            <td>
              <a-select
                popup-container="html"
                class="bacClass"
                v-model="pageData.list1"
                multiple
                @focus="focusSelsf"
              >
                <a-option v-for="(item, index) in numList" :value="item['printLs']" :key="index"
                  >{{ item['printLs'] }}
                </a-option>
              </a-select>
            </td>
          </tr>
        </table>
      </div>
    </a-modal>
    <a-modal v-model:visible="visiblecg6" ok-text="打印" @ok="print2" :width="800">
      <template #title> 巨丰 纱飞</template>
      <div id="dyy5">
        <h1 style="text-align: center; font-size: 30px"><b>织造一厂</b></h1>
        <table class="isTable1" v-for="(item, key, index) in idDtaDyss" :key="index">
          <tr>
            <th>打印人</th>
            <td>{{ item.printName }}</td>
            <th>打印时间</th>
            <td>{{ item.printTime }}</td>
          </tr>
          <tr>
            <th>计划单号</th>
            <td>{{ item.planOrderCode }}</td>
            <th>需求单号</th>
            <td>{{ item.planNeedCode }}</td>
          </tr>
          <tr>
            <th>拆纱单号</th>
            <td>{{ item.disassembleCode }}</td>
            <th>原料编码</th>
            <td>{{ item.rawmaterialCode }}</td>
          </tr>
          <tr>
            <th>原料名称</th>
            <td>{{ item.rawmaterialName }}</td>
            <th>纱牌</th>
            <td>{{ item.brandName }}</td>
          </tr>
          <tr>
            <th>色号/色称</th>
            <td>{{ item.colorCode }}/{{ item.colorName }}</td>
            <th>纱批</th>
            <td>{{ item.yarnBatch }}</td>
          </tr>
          <tr>
            <th>机台号</th>
            <td>{{ item.machineCode }}</td>
            <th>流水号</th>
            <td>{{ item.ls }}</td>
          </tr>
        </table>
      </div>
    </a-modal>
  </pageTabelLayout>
</template>

<script lang="ts">
  import { post, get } from '@/api/http'
  import {
    useTable,
    useRowKey,
    useTableColumn,
    usePagination,
    useRowSelection,
  } from '@/hooks/table'
  import printJS from 'print-js'
  import { EXELTABLE } from '@/utils/exportEXCEL'
  import QrcodeVue from 'qrcode.vue'
  import ModalDialog from '@/components/ModalDialog.vue'
  import { ref, reactive, onMounted } from 'vue'
  import Toolbar from '@/components/Toolbar.vue'
  import { ModalDialogType } from '@/types/components'
  import { Message, Modal } from '@arco-design/web-vue'
  import PageTabelLayout from '@/components/pageTabelLayout.vue'
  import WHService, { Warhouse, CompanyList, WhTypeField } from '@/service/wh'
  import WHStore from '@/store/modules/wh'
  import { localeText } from '@/api/aggridZw'
  import { pagingList } from '@/api/paging'
  import CorporateSectorCascader from '@/components/corporateSectorCascader/inde.vue'
  import dayjs from 'dayjs'
  import usePermission from '@/store/modules/permission'
  import { saveOrUpdateGridState as saveOrUpdateGridState01 } from '@/hooks/useGridState'
  import { saveOrUpdateGridState as saveOrUpdateGridState02 } from '@/hooks/useGridState'
  import tagRender from '@/components/aggridCellRenDerer/tagRender.vue'
  import inputRender from '@/components/aggridCellRenDerer/inputRender.vue'

  interface whTypeField {
    id: number | string | undefined
    serialNo: number
    warehouseId: number
    field: number | string | undefined
    mustState: number
    defaultValue: string
    selectState: number
    englishName: string
    valueType: number
    valueTypeNum: number
    showState: any
    saFeiPrintNum: any
  }

  const dataForm1 = reactive<whTypeField>({
    id: '',
    serialNo: 1,
    warehouseId: 0,
    field: '',
    mustState: 0,
    defaultValue: '',
    selectState: 0,
    englishName: '',
    valueType: 1,
    valueTypeNum: 0,
    showState: [],
    saFeiPrintNum: '',
  })

  interface ClothInfo {
    id: any
    planMaterialCode: any
    outStockNumber: any
    firm: any
    warehouse: any
    supplier: any
    outStockType: any
    customName: any
    yarnCode: any
    yarnName: any
    yarnBrand: any
    productionBatch: any
    level: any
    matchColor: any
    colorCode: any
    colorName: any
    pieceNumber: any
    pieceWeight: any
    bulkNumber: any
    bulkWeight: any
    weightTotal: any
    unit: any
    remark: any
    firmId: any
    warehouseId: any
    orderType: any
    weightPieceTotal: any
    bulkCount: any
  }
  const dataForm = reactive<ClothInfo>({
    id: '',
    planMaterialCode: '',
    outStockNumber: '',
    firm: '',
    warehouse: '',
    supplier: '',
    outStockType: '',
    customName: '',
    yarnCode: '',
    yarnName: '',
    yarnBrand: '',
    productionBatch: '',
    level: '',
    matchColor: '',
    colorCode: '',
    colorName: '',
    pieceNumber: '',
    pieceWeight: '',
    bulkNumber: '',
    bulkWeight: '',
    weightTotal: '',
    unit: '',
    remark: '',
    firmId: '',
    warehouseId: '',
    orderType: 0,
    weightPieceTotal: '',
    bulkCount: '',
  })

  export default {
    name: 'YarnStripPingDatas',
    setup() {
      const headerShow = ref<boolean>(true)
      const total = ref(10)
      const page = ref(1)
      const size = ref(10)
      const addDwDelRows = ref<any>([])

      function PageSize(val: any) {
        if (isIDs.value == 1) {
          pagination.page = val
          doRefresh()
        } else if (isIDs.value == 2) {
          pagination2.page = val
          doRefresh2()
        } else if (isIDs.value == 3) {
          pagination3.page = val
          doRefresh3()
        } else {
          pagination4.page = val
          doRefresh4()
        }
      }

      function change1(val: any) {
        console.log(val);
        
        if (isIDs.value == 1) {
          pagination.pageSize = val
          doRefresh()
        } else if (isIDs.value == 2) {
          pagination2.pageSize = val
          doRefresh2()
        } else if (isIDs.value == 3) {
          pagination3.pageSize = val
          doRefresh3()
        } else {
          pagination4.pageSize = val
          doRefresh4()
        }
      }

      let id = ref(1)

      //查询 未处理
      function doRefresh() {
        pageData.pageLoading = true
        updateGridState01()
        post({
          url: '/wms/yarnOutStock/getPage',
          data: {
            page: pagination.page,
            size: pagination.pageSize,
            queryType: 1,
            auditState: 1,
            warehouseId: searchData.wh,
            firmId: searchData.firm,
            yarnCode: pageData.yarnCode,
            yarnName: pageData.yarnName,
            yarnBrand: pageData.yarnBrand,
            productionBatch: pageData.productionBatch,
            level: pageData.level,
          },
        })
          .then(({ data, code }: any) => {
            if (code === 200) {
              // loadings.value = false
              // pagination.setTotalSize(data.total);
              // pageData.dataList = data.list
              if(data.list.length > 0){
                data.list.filter((o:any)=> o.outStockType != '转料虚拟入库' && o.outStockType != '虚拟入库')
              }
              table.handleSuccess(data.list)
              gridOption.value.setRowData(data.list)
              total.value = data.total
              createTotalRow()
            }
          })
          .catch(console.log)
          .finally(() => {
            pageData.pageLoading = false
          })
      }

      function doRefresh3() {
        pageData.pageLoading = true
        updateGridState03()
        post({
          url: '/wms/yarnOutStock/getPage',
          data: {
            page: pagination3.page,
            size: pagination3.pageSize,
            queryType: 1,
            auditState: 1,
            warehouseId: searchData.wh,
            firmId: searchData.firm,
            yarnCode: pageData.yarnCode,
            yarnName: pageData.yarnName,
            yarnBrand: pageData.yarnBrand,
            productionBatch: pageData.productionBatch,
            level: pageData.level,
          },
        })
          .then(({ data, code }: any) => {
            if (code === 200) {
              // loadings.value = false
              // pagination.setTotalSize(data.total);
              // pageData.dataList = data.list
              table.handleSuccess(data.list)
              gridOption3.value.setRowData(data.list)
              total.value = data.total
              createTotalRow()
            }
          })
          .catch(console.log)
          .finally(() => {
            pageData.pageLoading = false
          })
      }
      function doRefresh4() {
        pageData.pageLoading = true
        updateGridState04()
        post({
          url: '/wms/yarnOutStockReturn/getPage',
          data: {
            page: pagination4.page,
            size: pagination4.pageSize,
            firmId: searchData.firm,
            warehouseId: searchData.wh,
            yarnCode: pageData.yarnCode,
            yarnName: pageData.yarnName,
            yarnBrand: pageData.yarnBrand,
            productionBatch: pageData.productionBatch,
            level: pageData.level,
            outStockNumber: pageData.outStockNumber,
          },
        })
          .then(({ data, code }: any) => {
            if (code === 200) {
              // loadings.value = false
              // pagination.setTotalSize(data.total);
              // pageData.dataList = data.list
              table.handleSuccess(data.list)
              gridOption4.value.setRowData(data.list)
              total.value = data.total
              createTotalRow()
            }
          })
          .catch(console.log)
          .finally(() => {
            pageData.pageLoading = false
          })
      }

      //查询 未处理子表
      function doRefresh_son() {
        pageData.pageLoading = true
        post({
          url: '/planSingle/disassembleOrder/getNeedInfoByCheck',
          // data: [1, 2]
          data: gridOption.value.getSelectedRows().map((o: any) => {
            return o.planMaterialDetailId
          }),
        })
          .then(({ data, code }: any) => {
            if (code === 200) {
              pageData.cfList = data
              // pageData.cfList.forEach(function (o) {
              //   o.caseNumber = o.needPieceNum - o.allotPieceNum;
              //   // 分配整件件数默认值
              //   o.disassemblePieceNum = o.needPieceNum - o.allotPieceNum;

              //   // 分配总重量默认值
              //   o.disassembleWeight = o.disassemblePieceNum * o.pieceWeight
              //   o.disassembleBulkNumber = 0;
              //   o.disassembleBulkWeight = 0;
              // })
              var tempPieceNumber = dataForm.pieceNumber //临时存放，后面分配掉就减
              for (var i = 0; i < pageData.cfList.length; i++) {
                var needMinusAllot =
                  pageData.cfList[i].needPieceNum - pageData.cfList[i].allotPieceNum
                if (tempPieceNumber > needMinusAllot) {
                  // 情况 1(总可分配整件件数大于此行领料件数-已分配件数)
                  pageData.cfList[i].disassembleBulkNumber = 0 //分配散件件数
                  pageData.cfList[i].disassembleBulkCount = 0 //分配散件件数
                  pageData.cfList[i].disassembleBulkWeight = 0 //分配散件散重
                  pageData.cfList[i].disassemblePieceNum = needMinusAllot //此行未分配领料件数拉满
                  pageData.cfList[i].caseNumber = pageData.cfList[i].disassemblePieceNum //自动填箱数为分配的领料件数
                  pageData.cfList[i].disassembleWeight = Number(
                    (
                      pageData.cfList[i].disassemblePieceNum * pageData.cfList[i].pieceWeight
                    ).toFixed(2)
                  ) //算重量
                  tempPieceNumber = tempPieceNumber - pageData.cfList[i].disassemblePieceNum

                  //   if (tempPieceNumber > (pageData.cfList[i + 1]?.needPieceNum - pageData.cfList[i + 1]?.allotPieceNum)) {
                  //   console.log(111);

                  //   // 情况 2
                  //   pageData.cfList[i + 1].disassembleBulkNumber = 0;
                  //   pageData.cfList[i + 1].disassembleBulkWeight = 0;

                  //   pageData.cfList[i + 1].disassemblePieceNum = pageData.cfList[i + 1].needPieceNum - pageData.cfList[i + 1].allotPieceNum;
                  //   pageData.cfList[i + 1].caseNumber = pageData.cfList[i + 1].disassemblePieceNum;
                  //   pageData.cfList[i + 1].disassembleWeight = pageData.cfList[i + 1].disassemblePieceNum * pageData.cfList[i + 1].pieceWeight
                  // } else {
                  //   // 情况 3
                  //   pageData.cfList[i + 1].disassembleBulkNumber = 0;
                  //   pageData.cfList[i + 1].disassembleBulkWeight = 0;

                  //   pageData.cfList[i + 1].disassemblePieceNum = tempPieceNumber;
                  //   pageData.cfList[i + 1].caseNumber = pageData.cfList[i + 1].disassemblePieceNum;
                  //   pageData.cfList[i + 1].disassembleWeight = pageData.cfList[i + 1].disassemblePieceNum * pageData.cfList[i + 1].pieceWeight

                  // }
                  // i++; // 跳过下一个元素，因为它在内部条件中已被处理
                } else {
                  // 情况 4
                  pageData.cfList[i].disassembleBulkNumber = 0
                  pageData.cfList[i].disassembleBulkWeight = 0
                  pageData.cfList[i].disassembleBulkCount = 0 //分配散件件数

                  pageData.cfList[i].disassemblePieceNum = tempPieceNumber
                  tempPieceNumber = 0
                  // pageData.cfList[i].disassemblePieceNum = dataForm.pieceNumber;
                  pageData.cfList[i].caseNumber = pageData.cfList[i].disassemblePieceNum
                  pageData.cfList[i].disassembleWeight = Number(
                    (
                      pageData.cfList[i].disassemblePieceNum * pageData.cfList[i].pieceWeight
                    ).toFixed(2)
                  )
                }
              }
            }
          })
          .catch(console.log)
          .finally(() => {
            pageData.pageLoading = false
            // pageData.cfList.forEach(function (o) {
            //   console.log(o.disassembleBulkNumber)
            // })
          })
      }

      // 查询 已处理
      function doRefresh2() {
        pageData.pageLoading = true
        updateGridState02()
        post({
          url: '/planSingle/disassembleOrder/getPage',
          data: {
            page: pagination2.page,
            size: pagination2.pageSize,
            deleteState: 0,
            warehouseId: searchData.wh,
            firmId: searchData.firm,
            // disassembleCode: pageData.disassembleCode,
            rawmaterialCode: pageData.yarnCode,
            rawmaterialName: pageData.yarnName,
            brandName: pageData.yarnBrand,
            yarnBatch: pageData.productionBatch,
            level: pageData.level,
            startDate: pageData.startDate,
            endDate: pageData.endDate,
            disPrintState: pageData.disPrintState == 2 ? undefined : pageData.disPrintState,
            orderType: pageData.orderType == 2 ? undefined : pageData.orderType,
          },
        })
          .then(({ data, code }: any) => {
            if (code === 200) {
              table.handleSuccess(data.list)
              gridOption2.value.setRowData(data.list)
              total.value = data.total
              createTotalRow()
            }
          })
          .catch(console.log)
          .finally(() => {
            pageData.pageLoading = false
          })
      }

      const { selectedRowKeys, onSelectionChange } = useRowSelection()
      const selectedRowKeysChecked = useRowSelection()
      const pagination = usePagination(doRefresh)
      const pagination2 = usePagination(doRefresh2)
      const pagination3 = usePagination(doRefresh3)
      const pagination4 = usePagination(doRefresh4)
      const table = useTable()
      const rowKey = useRowKey('id')
      const tableColumns = useTableColumn([
        {
          title: '领料单号',
          key: 'planMaterialCode',
          dataIndex: 'planMaterialCode',
          width: 150,
        },
        {
          title: '出库单号',
          key: 'outStockNumber',
          dataIndex: 'outStockNumber',
          width: 150,
        },
        {
          title: '公司',
          key: 'firm',
          dataIndex: 'firm',
          width: 150,
        },

        {
          title: '仓库',
          key: 'warehouse',
          dataIndex: 'warehouse',
          width: 200,
        },
        {
          title: '出库类型',
          key: 'outStockType',
          dataIndex: 'outStockType',
          width: 200,
        },

        {
          title: '供应商名称',
          key: 'supplier',
          dataIndex: 'supplier',
          width: 200,
        },
        {
          title: '客户名称',
          key: 'customName',
          dataIndex: 'customName',
          width: 200,
        },
        {
          title: '原料编号',
          key: 'yarnCode',
          dataIndex: 'yarnCode',
          width: 200,
        },
        {
          title: '原料名称',
          key: 'yarnName',
          dataIndex: 'yarnName',
          width: 200,
        },
        {
          title: '纱牌',
          key: 'yarnBrand',
          dataIndex: 'yarnBrand',
          width: 200,
        },

        {
          title: '纱批',
          key: 'productionBatch',
          dataIndex: 'productionBatch',
          width: 200,
        },
        {
          title: '等级',
          key: 'level',
          dataIndex: 'level',
          width: 200,
        },
        {
          title: '可配色称',
          key: 'matchColor',
          dataIndex: 'matchColor',
          width: 200,
        },
        {
          title: '色号',
          key: 'colorCode',
          dataIndex: 'colorCode',
          width: 200,
        },
        {
          title: '色称',
          key: 'colorName',
          dataIndex: 'colorName',
          width: 200,
        },
        {
          title: '整件/件重',
          key: 'pieceWeight',
          dataIndex: 'pieceWeight',
          width: 200,
        },

        {
          title: '出库单-整件/件数',
          key: 'pieceNumber',
          dataIndex: 'pieceNumber',
          width: 200,
        },
        {
          title: '出库单-整件/总重量',
          key: 'weightPieceTotal',
          dataIndex: 'weightPieceTotal',
          width: 200,
          cellRenderer: {
            template: `<span>{{ weightPieceTotal }}</span>`,
            setup(props: any) {
              return {
                weightPieceTotal: Number(
                  (props.params.data.pieceWeight * props.params.data.pieceNumber).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '出库单-散件/件数',
          key: 'bulkNumber',
          dataIndex: 'bulkNumber',
          width: 200,
        },
        {
          title: '出库单-散件/个数',
          key: 'bulkCount',
          dataIndex: 'bulkCount',
          width: 200,
        },
        {
          title: '出库单-散件/散重',
          key: 'bulkWeight',
          dataIndex: 'bulkWeight',
          width: 200,
        },
        {
          title: '出库单-总重量',
          key: 'weightTotal',
          dataIndex: 'weightTotal',
          width: 200,
        },
        {
          title: '已拆纱-整件/件数',
          key: 'disassemblePieceNum',
          dataIndex: 'disassemblePieceNum',
          width: 200,
        },
        {
          title: '已拆纱-整件/总重量',
          key: 'disassemblePieceTotalWeight',
          dataIndex: 'disassemblePieceTotalWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ disassemblePieceTotalWeight }}</span>`,
            setup(props: any) {
              return {
                disassemblePieceTotalWeight: Number(
                  (props.params.data.disassemblePieceNum * props.params.data.pieceWeight).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '已拆纱-散件/个数',
          key: 'disassembleBulkCount',
          dataIndex: 'disassembleBulkCount',
          width: 200,
        },
        {
          title: '已拆纱-总重量',
          key: 'disassembleWeight',
          dataIndex: 'disassembleWeight',
          width: 200,
        },

        {
          title: '已拆纱-散件/件数',
          key: 'disassembleBulkNumber',
          dataIndex: 'disassembleBulkNumber',
          width: 200,
        },
        {
          title: '已拆纱-散件/散重',
          key: 'disassembleBulkWeight',
          dataIndex: 'disassembleBulkWeight',
          width: 200,
        },
        {
          title: '未拆纱-整件/件数',
          key: 'unDisassemblePieceNum',
          dataIndex: 'unDisassemblePieceNum',
          width: 200,
        },
        {
          title: '未拆纱-整件/总重量',
          key: 'unDisassemblePieceTotalWeight',
          dataIndex: 'unDisassemblePieceTotalWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ unDisassemblePieceTotalWeight }}</span>`,
            setup(props: any) {
              return {
                unDisassemblePieceTotalWeight: Number(
                  (props.params.data.unDisassemblePieceNum * props.params.data.pieceWeight).toFixed(
                    2
                  )
                ),
              }
            },
          },
        },
        {
          title: '未拆纱-散件/件数',
          key: 'unDisassembleBulkNumber',
          dataIndex: 'unDisassembleBulkNumber',
          width: 200,
        },
        {
          title: '未拆纱-散件/个数',
          key: 'unDisassembleBulkCount',
          dataIndex: 'unDisassembleBulkCount',
          width: 200,
          cellRenderer: {
            template: `<span>{{ unDisassembleBulkCount }}</span>`,
            setup(props: any) {
              return {
                unDisassembleBulkCount: Number(
                  (
                    props.params.data.bulkCount -
                    props.params.data.returnStockBulkCount -
                    props.params.data.disassembleBulkCount
                  ).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '未拆纱-散件/散重',
          key: 'unDisassembleBulkWeight',
          dataIndex: 'unDisassembleBulkWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ unDisassembleBulkWeight }}</span>`,
            setup(props: any) {
              return {
                unDisassembleBulkWeight: Number(
                  (
                    props.params.data.bulkWeight -
                    props.params.data.returnStockBulkWeight -
                    props.params.data.disassembleBulkWeight
                  ).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '未拆纱-总重量',
          key: 'unDisassembleTotalWeight',
          dataIndex: 'unDisassembleTotalWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ unDisassembleTotalWeight }}</span>`,
            setup(props: any) {
              return {
                unDisassembleTotalWeight: Number(
                  (
                    props.params.data.weightTotal -
                    props.params.data.disassembleWeight -
                    props.params.data.returnStockWeight
                  ).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '已退库-整件/件数',
          key: 'returnStockPieceNum',
          dataIndex: 'returnStockPieceNum',
          width: 200,
        },
        {
          title: '已退库-整件/总重量',
          key: 'returnStockPieceTotalWeight',
          dataIndex: 'returnStockPieceTotalWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ returnStockPieceTotalWeight }}</span>`,
            setup(props: any) {
              return {
                returnStockPieceTotalWeight: Number(
                  (props.params.data.pieceWeight * props.params.data.returnStockPieceNum).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '已退库-散件/件数',
          key: 'returnStockBulkNumber',
          dataIndex: 'returnStockBulkNumber',
          width: 200,
        },
        {
          title: '已退库-散件/个数',
          key: 'returnStockBulkCount',
          dataIndex: 'returnStockBulkCount',
          width: 200,
        },
        {
          title: '已退库-散件/散重',
          key: 'returnStockBulkWeight',
          dataIndex: 'returnStockBulkWeight',
          width: 200,
        },
        {
          title: '已退库-总重量',
          key: 'returnStockWeight',
          dataIndex: 'returnStockWeight',
          width: 200,
        },
        {
          title: '单位',
          key: 'unit',
          dataIndex: 'unit',
          width: 200,
        },
        {
          title: '备注',
          key: 'remark',
          dataIndex: 'remark',
          width: 200,
        },
      ])
      const tableColumns3 = useTableColumn([
        {
          title: '领料单号',
          key: 'planMaterialCode',
          dataIndex: 'planMaterialCode',
          width: 150,
        },
        {
          title: '出库单号',
          key: 'outStockNumber',
          dataIndex: 'outStockNumber',
          width: 150,
        },
        {
          title: '公司',
          key: 'firm',
          dataIndex: 'firm',
          width: 150,
        },

        {
          title: '仓库',
          key: 'warehouse',
          dataIndex: 'warehouse',
          width: 200,
        },
        {
          title: '出库类型',
          key: 'outStockType',
          dataIndex: 'outStockType',
          width: 200,
        },

        {
          title: '供应商名称',
          key: 'supplier',
          dataIndex: 'supplier',
          width: 200,
        },
        {
          title: '客户名称',
          key: 'customName',
          dataIndex: 'customName',
          width: 200,
        },
        {
          title: '原料编号',
          key: 'yarnCode',
          dataIndex: 'yarnCode',
          width: 200,
        },
        {
          title: '原料名称',
          key: 'yarnName',
          dataIndex: 'yarnName',
          width: 200,
        },
        {
          title: '纱牌',
          key: 'yarnBrand',
          dataIndex: 'yarnBrand',
          width: 200,
        },

        {
          title: '纱批',
          key: 'productionBatch',
          dataIndex: 'productionBatch',
          width: 200,
        },
        {
          title: '等级',
          key: 'level',
          dataIndex: 'level',
          width: 200,
        },
        {
          title: '可配色称',
          key: 'matchColor',
          dataIndex: 'matchColor',
          width: 200,
        },
        {
          title: '色号',
          key: 'colorCode',
          dataIndex: 'colorCode',
          width: 200,
        },
        {
          title: '色称',
          key: 'colorName',
          dataIndex: 'colorName',
          width: 200,
        },
        {
          title: '整件/件重',
          key: 'pieceWeight',
          dataIndex: 'pieceWeight',
          width: 200,
        },

        {
          title: '出库单-整件/件数',
          key: 'pieceNumber',
          dataIndex: 'pieceNumber',
          width: 200,
        },
        {
          title: '出库单-整件/总重量',
          key: 'weightPieceTotal',
          dataIndex: 'weightPieceTotal',
          width: 200,
          cellRenderer: {
            template: `<span>{{ weightPieceTotal }}</span>`,
            setup(props: any) {
              return {
                weightPieceTotal: Number(
                  (props.params.data.pieceWeight * props.params.data.pieceNumber).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '出库单-散件/件数',
          key: 'bulkNumber',
          dataIndex: 'bulkNumber',
          width: 200,
        },
        {
          title: '出库单-散件/个数',
          key: 'bulkCount',
          dataIndex: 'bulkCount',
          width: 200,
        },
        {
          title: '出库单-散件/散重',
          key: 'bulkWeight',
          dataIndex: 'bulkWeight',
          width: 200,
        },
        {
          title: '出库单-总重量',
          key: 'weightTotal',
          dataIndex: 'weightTotal',
          width: 200,
        },
        {
          title: '已拆纱-整件/件数',
          key: 'disassemblePieceNum',
          dataIndex: 'disassemblePieceNum',
          width: 200,
        },
        {
          title: '已拆纱-整件/总重量',
          key: 'disassemblePieceTotalWeight',
          dataIndex: 'disassemblePieceTotalWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ disassemblePieceTotalWeight }}</span>`,
            setup(props: any) {
              return {
                disassemblePieceTotalWeight: Number(
                  (props.params.data.disassemblePieceNum * props.params.data.pieceWeight).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '已拆纱-散件/个数',
          key: 'disassembleBulkCount',
          dataIndex: 'disassembleBulkCount',
          width: 200,
        },
        {
          title: '已拆纱-总重量',
          key: 'disassembleWeight',
          dataIndex: 'disassembleWeight',
          width: 200,
        },

        {
          title: '已拆纱-散件/件数',
          key: 'disassembleBulkNumber',
          dataIndex: 'disassembleBulkNumber',
          width: 200,
        },
        {
          title: '已拆纱-散件/散重',
          key: 'disassembleBulkWeight',
          dataIndex: 'disassembleBulkWeight',
          width: 200,
        },
        {
          title: '可退库-整件/件数',
          key: 'unDisassemblePieceNum',
        },
        {
          title: '可退库-整件/总重量',
          key: 'unDisassembleTotalWeight',
          width: 200,
        },
        {
          title: '可退库-散件/件数',
          key: 'unDisassembleBulkNumber',
          width: 200,
        },
        {
          title: '可退库-散件/个数',
          key: 'unDisassembleBulkCount',
          width: 200,
        },
        {
          title: '可退库-散件/散重',
          key: 'unDisassembleBulkWeight',
          width: 200,
        },
        {
          title: '可退库-总重量',
          key: 'unDisassembleWeight',
          width: 200,
        },
        {
          title: '已退库-整件/件数',
          key: 'returnStockPieceNum',
          dataIndex: 'returnStockPieceNum',
          width: 200,
        },
        {
          title: '已退库-整件/总重量',
          key: 'returnStockPieceTotalWeight',
          dataIndex: 'returnStockPieceTotalWeight',
          width: 200,
          cellRenderer: {
            template: `<span>{{ returnStockPieceTotalWeight }}</span>`,
            setup(props: any) {
              return {
                returnStockPieceTotalWeight: Number(
                  (props.params.data.pieceWeight * props.params.data.returnStockPieceNum).toFixed(2)
                ),
              }
            },
          },
        },
        {
          title: '已退库-散件/件数',
          key: 'returnStockBulkNumber',
          dataIndex: 'returnStockBulkNumber',
          width: 200,
        },
        {
          title: '已退库-散件/个数',
          key: 'returnStockBulkCount',
          dataIndex: 'returnStockBulkCount',
          width: 200,
        },
        {
          title: '已退库-散件/散重',
          key: 'returnStockBulkWeight',
          dataIndex: 'returnStockBulkWeight',
          width: 200,
        },
        {
          title: '已退库-总重量',
          key: 'returnStockWeight',
          dataIndex: 'returnStockWeight',
          width: 200,
        },
        {
          title: '单位',
          key: 'unit',
          dataIndex: 'unit',
          width: 200,
        },
        {
          title: '备注',
          key: 'remark',
          dataIndex: 'remark',
          width: 200,
        },
      ])
      const tableColumns4 = useTableColumn([
        {
          title: '领料单号',
          key: 'planMaterialCode',
          dataIndex: 'planMaterialCode',
          width: 150,
        },
        {
          title: '出库单号',
          key: 'outStockNumber',
          dataIndex: 'outStockNumber',
          width: 150,
        },
        {
          title: '出库单号',
          key: 'outStockNumber',
          width: 250,
        },

        {
          title: '公司名称',
          key: 'firm',
          width: 200,
        },
        {
          title: '出库名称',
          key: 'warehouse',
          width: 200,
        },

        {
          title: '供应商名称',
          key: 'supplier',
          width: 200,
        },
        {
          title: '客户名称',
          key: 'customName',
          width: 200,
        },
        {
          title: '原料编号',
          key: 'yarnCode',
          width: 200,
        },
        {
          title: '原料名称',
          key: 'yarnName',
          width: 200,
        },
        {
          title: '纱牌',
          key: 'yarnBrand',
          width: 200,
        },

        {
          title: '纱批',
          key: 'productionBatch',
          width: 200,
        },
        {
          title: '等级',
          key: 'level',
          width: 200,
        },
        {
          title: '可配色称',
          key: 'matchColor',
          width: 200,
        },
        {
          title: '色号',
          key: 'colorCode',
          width: 200,
        },
        {
          title: '色称',
          key: 'colorName',
          width: 200,
        },
        {
          title: '整件/件重',
          key: 'pieceWeight',
          width: 200,
        },

        {
          title: '整件/件数',
          key: 'returnStockPieceNum',
          width: 200,
        },
        {
          title: '整件/总重量',
          key: 'returnStockPieceTotalNum',
          width: 200,
        },
        {
          title: '散件/件数',
          key: 'returnStockBulkNumber',
          width: 200,
        },
        {
          title: '散件/个数',
          key: 'returnStockBulkCount',
          width: 200,
        },
        {
          title: '散件/散重',
          key: 'returnStockBulkWeight',
          width: 200,
        },
        {
          title: '总重量',
          key: 'returnStockWeight',
          width: 200,
        },
        {
          title: '备注',
          key: 'remark',
          width: 200,
        },
        {
          title: '退库人',
          key: 'createName',
          width: 200,
        },
        {
          title: '退库时间',
          key: 'createDate',
          width: 200,
        },
      ])
      const tableColumnsCf = [
        {
          headerName: '需求单号',
          field: 'planNeedCode',
          // pinner: 'left',
          width: 150,
        },
        {
          headerName: '织布单号',
          field: 'planOrderCode',
          // pinner: 'left',
          width: 150,
        },
        {
          headerName: '机台号',
          field: 'machineCode',
          // pinner: 'left',
          width: 100,
        },
        {
          headerName: '备注',
          field: 'remark',
          width: 150,
        },
        {
          headerName: '整件/件重',
          field: 'pieceWeight',
          width: 150,
        },
        {
          headerName: '领料件数',
          field: 'needPieceNum',
          width: 150,
        },
        {
          headerName: '领料重量',
          field: 'needWeight',
          width: 150,
        },
        {
          headerName: '已分配',
          children: [
            {
              headerName: '整件/件数',
              field: 'allotPieceNum',
              width: 150,
            },
            {
              headerName: '整件/总重量',
              field: 'allotPieceTotalWeight',
              width: 150,
              cellRenderer: {
                template: `<span>{{ allotPieceTotalWeight }}</span>`,
                setup(props: any) {
                  let allotPieceTotalWeight = ref(
                    Number(
                      (props.params.data.allotPieceNum * props.params.data.pieceWeight).toFixed(2)
                    )
                  )
                  return {
                    allotPieceTotalWeight,
                  }
                },
              },
            },
            {
              headerName: '散件/件数',
              field: 'allotBulkNumber',
              width: 150,
            },
            {
              headerName: '散件/个数',
              field: 'allotBulkCount',
              width: 150,
            },
            {
              headerName: '散件/散重',
              field: 'allotBulkWeight',
              width: 150,
            },
            {
              headerName: '总重量',
              field: 'allotWeight',
              width: 150,
            },
          ],
        },
        {
          headerName: '分配',
          children: [
            {
              headerName: '整件/件数',
              field: 'disassemblePieceNum',
              pinner: 'right',
              cellRenderer: inputRender,
              cellRendererParams: {
                maxNumberKey: `${dataForm.pieceNumber}`,
              },
              valueSetter: (params: any) => {
                const newValue = params.newValue
                params.data.disassemblePieceNum = newValue
                changeTable(params.data)
                return true
              },
              width: 150,
            },

            {
              headerName: '整件/总重量',
              field: 'disassembleTotalWeight',
              pinner: 'right',
              cellRenderer: {
                template: `
            <el-input disabled v-model="disassembleTotalWeight" controls-position="right" :precision="2"/>`,
                setup(props: any) {
                  let disassembleTotalWeight = ref(
                    (props.params.data.pieceWeight * props.params.data.disassemblePieceNum).toFixed(
                      2
                    )
                  )
                  return {
                    disassembleTotalWeight,
                  }
                },
              },
              width: 150,
            },

            {
              headerName: '散件/件数',
              field: 'disassembleBulkNumber',
              pinner: 'right',
              width: 150,
              cellRenderer: inputRender,
              cellRendererParams: {
                maxNumberKey: `${dataForm.bulkNumber}`,
              },
              valueSetter: (params: any) => {
                const newValue = params.newValue
                params.data.disassembleBulkNumber = newValue
                changeDbn(params.data)
                return true
              },
            },
            {
              headerName: '散件/个数',
              field: 'disassembleBulkCount',
              pinner: 'right',
              width: 150,
              cellRenderer: inputRender,
              cellRendererParams: {
                maxNumberKey: `${dataForm.bulkCount}`,
              },
              valueSetter: (params: any) => {
                // ////debugger
                const newValue = params.newValue
                params.data.disassembleBulkCount = newValue
                changeDbc(params.data)
                return true
              },
            },
            {
              headerName: '散件/散重',
              field: 'disassembleBulkWeight',
              pinner: 'right',
              width: 150,
              cellRenderer: inputRender,
              cellRendererParams: {
                maxNumberKey: `${dataForm.bulkWeight}`,
              },

              valueSetter: (params: any) => {
                const newValue = params.newValue
                params.data.disassembleBulkWeight = newValue
                changeDbw(params.data)
                return true
              },
            },

            {
              headerName: '总重量',
              field: 'disassembleWeight',
              pinner: 'right',
              width: 150,
              valueGetter: (params) => {
                return Number(Number(params.data.disassemblePieceNum) * Number(params.data.pieceWeight)+Number(params.data.disassembleBulkWeight)).toFixed(2)
              },
            //   cellRenderer: {
            //     template: `
            // <el-input-number disabled v-model="val.disassembleWeight" controls-position="right" :precision="2"/>`,
            //     setup(props: any) {
            //       let val = ref(props.params.data)
            //       return {
            //         val,
            //       }
            //     },
            //   },
            },
          ],
        },
        {
          headerName: '箱数',
          field: 'caseNumber',
          pinner: 'right',
          width: 80,
          cellRenderer: inputRender,
        },
      ]
      let tc3: any[] = tableColumns3.map((o) => {
        let obj = {
          headerName: o.title,
          field: o.key,
          pinned: o['fixed'],
          tooltipField: o.key,
          cellRenderer: o.cellRenderer,
        }
        return obj
      })
      let tc4: any[] = tableColumns4.map((o) => {
        let obj = {
          headerName: o.title,
          field: o.key,
          pinned: o['fixed'],
          tooltipField: o.key,
          cellRenderer: o.cellRenderer,
        }
        return obj
      })
      let tc1: any[] = tableColumns.map((o) => {
        let obj = {
          headerName: o.title,
          field: o.key,
          pinned: o['fixed'],
          tooltipField: o.key,
          cellRenderer: o.cellRenderer,
        }
        return obj
      })

      let a1 = [
        {
          showRowGroup: 'hide_def',
          headerName: '',
          checkboxSelection: true,
          headerCheckboxSelection: true,
          pinned: 'left',
          width: 50,
          resizable: false,
          filter: false,
          sortable: false,
          minWidth: 50,
          maxWidth: 50,
          lockPosition: 'left',
        },
      ]
      tc1 = a1.concat(tc1)
      tc3 = a1.concat(tc3)
      tc4 = a1.concat(tc4)
      const tc2 = [
        {
          field: '',
          headerCheckboxSelection: true,
          checkboxSelection: true,
          width: 50,
          showDisabledCheckboxes: false,
          pinned: 'left',
        },
        {
          headerName: '原料名称',
          field: 'rawmaterialName',
          dataIndex: 'rawmaterialName',
          width: 200,
        },
        {
          headerName: '原料编号',
          field: 'rawmaterialCode',
          dataIndex: 'rawmaterialCode',
          width: 150,
        },
        {
          headerName: '公司',
          field: 'company',
          dataIndex: 'company',
          width: 150,
        },
        {
          headerName: '仓库',
          field: 'warehouseName',
          dataIndex: 'warehouseName',
          width: 20,
        },
        {
          headerName: '需求单号',
          field: 'planNeedCode',
          dataIndex: 'planNeedCode',
          width: 150,
        },
        {
          headerName: '织布单号',
          field: 'planOrderCode',
          dataIndex: 'planOrderCode',
          width: 200,
        },
        {
          headerName: '拆纱单号',
          field: 'disassembleCode',
          dataIndex: 'disassembleCode',
          width: 200,
        },

        {
          headerName: '纱牌',
          field: 'brandName',
          dataIndex: 'brandName',
          width: 200,
        },
        {
          headerName: '机台号',
          field: 'machineCode',
          dataIndex: 'machineCode',
          width: 200,
        },
        {
          headerName: '箱数',
          field: 'caseNumber',
          dataIndex: 'caseNumber',
          width: 200,
        },
        {
          headerName: '备注',
          field: 'remark',
          dataIndex: 'remark',
          width: 200,
        },
        {
          headerName: '纱批',
          field: 'yarnBatch',
          dataIndex: 'yarnBatch',
          width: 200,
        },
        {
          headerName: '单位',
          field: 'unit',
          dataIndex: 'unit',
          width: 200,
        },
        {
          headerName: '色称',
          field: 'colorName',
          dataIndex: 'colorName',
          width: 150,
        },
        {
          headerName: '色号',
          field: 'colorCode',
          dataIndex: 'colorCode',
          width: 200,
        },

        {
          headerName: '拆纱件数',
          field: 'disassemblePieceNum',
          dataIndex: 'disassemblePieceNum',
          width: 200,
        },
        {
          headerName: '拆纱数量',
          field: 'disassembleWeight',
          dataIndex: 'disassembleWeight',
          width: 200,
        },
        {
          headerName: '拆纱单打印状态',
          field: 'disPrintState',
          slotName: 'actions',
          dataIndex: 'disPrintState',
          width: 150,
          pinned: 'right',
          cellRenderer: tagRender,
          cellRendererParams: {
            styleClass: (params: any) => {
              const type =
                params.disPrintState == 0 ? 'primary' : params.disPrintState == 1 ? 'success' : ''
              return type
            },
            text: (params: any) => {
              const text =
                params.disPrintState == 0 ? '未打印' : params.disPrintState == 1 ? '已打印' : ''
              return text
            },
            eltagSize: 0,
          },
          filterParams: {
            valueFormatter: function (params: any) {
              return params.value == '0' ? '未打印' : params.value == '1' ? '已打印' : ''
            },
          },
        },
        {
          headerName: '拆纱单类型',
          field: 'orderType',
          slotName: 'orderType',
          dataIndex: 'orderType',
          width: 200,
          cellRenderer: {
            template: `<span>{{ a == '0' ? '拆纱单' : a == '1' ? '发纱单' : '' }}</span>`,
            setup(props: any) {
              return {
                a: props.params.data.orderType,
              }
            },
          },
          filterParams: {
            valueFormatter: function (params: any) {
              return params.value == '0' ? '拆纱单' : params.value == '1' ? '发纱单' : ''
            },
          },
        },
        {
          headerName: '纱飞打印次数',
          field: 'saFeiPrintNum',
          slotName: 'saFeiPrintNum',
          dataIndex: 'saFeiPrintNum',
          width: 200,
        },
        {
          headerName: '创建人',
          field: 'createName',
          width: 150,
        },
        {
          headerName: '创建时间',
          field: 'createTime',
          width: 150,
        },
        {
          headerName: '纱飞打印状态',
          field: 'saFeiPrintNum1',
          slotName: 'actions1',
          dataIndex: 'saFeiPrintNum',
          width: 150,
          pinned: 'right',
          cellRenderer: tagRender,
          cellRendererParams: {
            styleClass: (params: any) => {
              return params.saFeiPrintNum == 0
                ? 'primary'
                : params.saFeiPrintNum == 1
                ? 'success'
                : ''
            },
            text: (params: any) => {
              return params.saFeiPrintNum == 0 ? '未打印' : params.saFeiPrintNum > 1 ? '已打印' : ''
            },
            eltagSize: 0,
          },
          filterParams: {
            valueFormatter: function (params: any) {
              return params.value == '0' ? '未打印' : '已打印'
            },
          },
        },
        // {
        //     headerName: "操作",
        //     field: "id",
        //     dataIndex: "id",
        //     slotName: "actions2",
        //     width: 150,
        //     fixed: "right"
        // }
      ]
      const pageData = reactive<{
        yarnCode: any
        yarnName: any
        yarnBrand: any
        productionBatch: any
        level: any
        cfList: any[]

        showAdd_cjcsd: boolean
        show_csdtk: boolean
        rawmaterialCode: any
        planNeedCode: any
        orderNo: any
        sideTitle1: any
        showAdd1: boolean
        saFeiPrintNum: any
        stockAllPieceNum: any
        disassembleCode: any
        showAdd: boolean
        sideTitle: string
        dutymachineCode: any
        greyCode: any
        grayName: any
        planOrderCode: any
        weaveCode: any
        storey: any
        dutymachineDate: any[]
        dutymachineDate1: any[]
        pageLoading: boolean
        rHeight: any
        dutymachineState: number | undefined
        checkHeadList: any[]
        checkBodyList: any[]
        bodyValueList: any[]
        dataList: any[]
        machineCodeOb: {}
        getList: any[]
        dropDownList: any[]
        tcDutymachineCode: any
        tcStorey: any
        tcDutymachineCodeList: any[]
        tcStoreyList: any[]
        ygType: any
        ygName: any
        ygTypeList: any[]
        ygNameList: any[]
        firmList: any[]
        firmId: any
        isShow: boolean
        isShow1: boolean
        filterList: any[]
        editYgTime: any[]
        employeeId: any
        employeeName: string | undefined
        NowDate: any
        dutymachineId: any
        dateStart: any
        dateEnd: any
        lists: any[]
        clothList: []
        list1: any[]
        btnList: any[]
        btnList1: any[]
        btnList2: any[]
        btnList3: any[]
        startDate: any
        endDate: any
        titleOPen: any
        disPrintState: any
        orderType: any
      }>({
        disPrintState: 0,
        orderType: 0,
        titleOPen: ' 打印纱飞单',
        yarnCode: '',
        yarnName: '',
        yarnBrand: '',
        productionBatch: '',
        level: '',
        cfList: [],
        show_csdtk: false,
        showAdd_cjcsd: false,
        rawmaterialCode: '',
        planNeedCode: '',
        orderNo: '',
        sideTitle1: '修改打印张数',
        showAdd1: false,
        saFeiPrintNum: '',
        stockAllPieceNum: '',
        disassembleCode: '',
        showAdd: false,
        sideTitle: '新增值机派工',
        dutymachineCode: '',
        greyCode: '',
        grayName: '',
        planOrderCode: '',
        weaveCode: '',
        storey: '',
        dutymachineDate: [],
        dutymachineDate1: [],
        pageLoading: false,
        rHeight: '',
        dutymachineState: 0,
        checkHeadList: [],
        checkBodyList: [],
        bodyValueList: [],
        dataList: [],
        machineCodeOb: {},
        getList: [],
        dropDownList: [],
        tcDutymachineCode: '',
        tcStorey: '',
        tcDutymachineCodeList: [],
        tcStoreyList: [],
        ygType: '',
        ygName: '',
        ygTypeList: [],
        ygNameList: [],
        firmList: [],
        firmId: null,
        isShow: true,
        isShow1: true,
        filterList: [],
        editYgTime: [],
        employeeId: null,
        employeeName: '',
        NowDate: '',
        dutymachineId: null,
        dateStart: '',
        dateEnd: '',
        lists: [],
        clothList: [],
        list1: [],
        btnList: [],
        btnList1: [],
        btnList2: [],
        btnList3: [],
        startDate: dayjs().format('YYYY-MM-DD'),
        endDate: dayjs().format('YYYY-MM-DD'),
      })
      //下拉框得到焦点
      const focusSel = (val: any) => {
        selCxAll(val)
      }
      //下拉数据
      const options = ref<any>(pageData.dropDownList)
      const loading = ref(false)
      const handleSearch = (value: any) => {
        if (value) {
          const ob = { dutymachineCode: value }
          loading.value = true
          selCxAll(ob)
          options.value = pageData.dropDownList
          loading.value = false
        } else {
          options.value = []
        }
      }
      const handleSearch1 = (value: any) => {
        if (value) {
          const ob = { greyCode: value }
          loading.value = true
          selCxAll(ob)
          options.value = pageData.dropDownList
          loading.value = false
        } else {
          options.value = []
        }
      }
      const handleSearch2 = (value: any) => {
        if (value) {
          const ob = { orderNo: value }
          loading.value = true
          selCxAll(ob)
          options.value = pageData.dropDownList
          loading.value = false
        } else {
          options.value = []
        }
      }
      const handleSearch3 = (value: any) => {
        if (value) {
          const ob = { planOrderCode: value }
          loading.value = true
          selCxAll(ob)
          options.value = pageData.dropDownList
          loading.value = false
        } else {
          options.value = []
        }
      }
      const handleSearch4 = (value: any) => {
        if (value) {
          const ob = { disassembleCode: value }
          loading.value = true
          selCxAll(ob)
          options.value = pageData.dropDownList
          loading.value = false
        } else {
          options.value = []
        }
      }
      const handleSearch5 = (value: any) => {
        if (value) {
          const ob = { planMaterialCode: value }
          loading.value = true
          selCxAll1(ob)
          options.value = pageData.dropDownList
          loading.value = false
        } else {
          options.value = []
        }
      }
      const gridOptionRef2: any = ref(null)

      const ktktks = () => {
        if (gridOption3.value.getSelectedRows().length != 1) {
          Message.error('请勾选一条行数据！')
          return
        }
        pageData.show_csdtk = true

        console.log(gridOption3.value.getSelectedRows())
        //设置默认值

        nextTick(() => {
          
          let maxArr = gridOption3.value.getSelectedRows()[0]
          
          maxArr['maxUnDisassemblePieceNum'] = maxArr.unDisassemblePieceNum
          maxArr['maxUnDisassembleBulkNumber'] = maxArr.unDisassembleBulkNumber
          maxArr['maxUnDisassembleBulkCount'] = maxArr.unDisassembleBulkCount
          maxArr['maxUnDisassembleBulkWeight'] = maxArr.unDisassembleBulkWeight
          // console.log(arr);
          // // arr['unDisassemblePieceNum']=arr.pieceNumber- arr.disassemblePieceNum- arr.returnStockPieceNum
          // // arr['unDisassembleBulkNumber']=arr.bulkNumber- arr.unDisassembleBulkNumber- arr.returnStockBulkNumber
          // // arr['unDisassemblePieceTotalWeight']=Number(arr.data.unDisassemblePieceNum* arr.pieceWeight).toFixed(2)
          // arr['unDisassembleBulkCount'] =
          // (arr.blukCount - arr.disassembleBulkCount - arr.returnStockBulkCount)?(arr.blukCount - arr.disassembleBulkCount - arr.returnStockBulkCount):0
          // arr['unDisassembleBulkWeight'] =
          //   arr.bulkWeight - arr.disassembleBulkWeight - arr.returnStockBulkWeight
          // arr['unDisassembleTotalWeight'] = Number(
          //   (
          //     arr.unDisassemblePieceNum * arr.pieceWeight +
          //      arr.unDisassembleBulkWeight
          //   ).toFixed(2)
          // )
    
          gridOptionRef2.value.setdataListIterface(gridOption3.value.getSelectedRows())
          console.log(maxArr);
          
        })
      }
      const stockDrawOk = () => {
        let list = gridOption3.value.getSelectedRows()[0]
        console.log(list)

       

        // return
        let ParamsData = {
          id: list.id,
          returnStockBulkNumber: list.unDisassembleBulkNumber ? list.unDisassembleBulkNumber : 0,
          returnStockBulkCount: list.unDisassembleBulkCount ? list.unDisassembleBulkCount : 0,
          returnStockPieceNum: list.unDisassemblePieceNum ? list.unDisassemblePieceNum : 0,
          returnStockBulkWeight: list.unDisassembleBulkWeight ? list.unDisassembleBulkWeight : 0,
          returnStockWeight: list.unDisassembleTotalWeight
            ? list.unDisassembleTotalWeight
            : (
                 list.unDisassembleBulkWeight +
                list.pieceWeight * list.unDisassemblePieceNum
              ).toFixed(2),
        }
        console.log(ParamsData)
        if(ParamsData.returnStockWeight==0){
         Message.warning('退库总重量不能为0！')

          return
        }
if(ParamsData.returnStockBulkNumber!==0&&ParamsData.returnStockBulkWeight==0){
  Message.warning('请确认退库散件/件数 散件/散重 是否有误')

return
}
if(ParamsData.returnStockBulkNumber==0&&ParamsData.returnStockBulkWeight!==0){
  Message.warning('请确认退库散件/件数 散件/散重 是否有误')

return
}

        post({
          url: '/wms/yarnOutStock/returnYarnOutStock',
          data: ParamsData,
        })
          .then((res: any) => {
            if (res.code === 200) {
              // formRef.value?.resetFields();
              pageData.show_csdtk = false
              Message.success({
                content: '退库成功',
                duration: 5000,
              })
              
            } else {
              Message.error({
                content: res.message,
                duration: 5000,
              })
            }
          })
          .finally(() => {
            doRefresh3()
            pageData.pageLoading = false
          })
      }

      const tableColumns2: any = [
        {
          headerName: '领料单号',
          field: 'planMaterialCode',
          dataIndex: 'planMaterialCode',
          width: 150,
        },
        {
          headerName: '出库单号',
          field: 'outStockNumber',
          dataIndex: 'outStockNumber',
          width: 150,
        },
        {
          headerName: '公司',
          field: 'firm',
          dataIndex: 'firm',
          width: 150,
        },

        {
          headerName: '仓库',
          field: 'warehouse',
          dataIndex: 'warehouse',
          width: 200,
        },
        {
          headerName: '出库类型',
          field: 'outStockType',
          dataIndex: 'outStockType',
          width: 200,
        },

        {
          headerName: '供应商名称',
          field: 'supplier',
          dataIndex: 'supplier',
          width: 200,
        },
        {
          headerName: '客户名称',
          field: 'customName',
          dataIndex: 'customName',
          width: 200,
        },
        {
          headerName: '原料编号',
          field: 'yarnCode',
          dataIndex: 'yarnCode',
          width: 200,
        },
        {
          headerName: '原料名称',
          field: 'yarnName',
          dataIndex: 'yarnName',
          width: 200,
        },
        {
          headerName: '纱牌',
          field: 'yarnBrand',
          dataIndex: 'yarnBrand',
          width: 200,
        },

        {
          headerName: '纱批',
          field: 'productionBatch',
          dataIndex: 'productionBatch',
          width: 200,
        },
        {
          headerName: '等级',
          field: 'level',
          dataIndex: 'level',
          width: 200,
        },
        {
          headerName: '可配色称',
          field: 'matchColor',
          dataIndex: 'matchColor',
          width: 200,
        },
        {
          headerName: '色号',
          field: 'colorCode',
          dataIndex: 'colorCode',
          width: 200,
        },
        {
          headerName: '色称',
          field: 'colorName',
          dataIndex: 'colorName',
          width: 200,
        },
        {
          headerName: '整件/件重',
          field: 'pieceWeight',
          dataIndex: 'pieceWeight',
          width: 200,
        },
        {
          headerName: '出库单',
          children: [
            {
              headerName: '出库单-整件/件数',
              field: 'pieceNumber',
              dataIndex: 'pieceNumber',
              width: 200,
            },
            {
              headerName: '出库单-整件/总重量',
              field: 'weightPieceTotal',
              dataIndex: 'weightPieceTotal',
              width: 200,
              cellRenderer: {
                template: `<span>{{ weightPieceTotal }}</span>`,
                setup(props: any) {
                  return {
                    weightPieceTotal: Number(
                      (props.params.data.pieceWeight * props.params.data.pieceNumber).toFixed(2)
                    ),
                  }
                },
              },
            },
            {
              headerName: '出库单-散件/件数',
              field: 'bulkNumber',
              dataIndex: 'bulkNumber',
              width: 200,
            },
            {
              headerName: '出库单-散件/个数',
              field: 'bulkCount',
              dataIndex: 'bulkCount',
              width: 200,
            },
            {
              headerName: '出库单-散件/散重',
              field: 'bulkWeight',
              dataIndex: 'bulkWeight',
              width: 200,
            },
            {
              headerName: '出库单-总重量',
              field: 'weightTotal',
              dataIndex: 'weightTotal',
              width: 200,
            },
          ],
        },
        {
          headerName: '已拆纱',
          children: [
            {
              headerName: '整件/件数',
              field: 'disassemblePieceNum',
              dataIndex: 'disassemblePieceNum',
              width: 200,
            },

            {
              headerName: '整件/总重量',
              field: 'disassemblePieceTotalWeight',
              dataIndex: 'disassemblePieceTotalWeight',
              width: 200,
              cellRenderer: {
                template: `<span>{{ disassemblePieceTotalWeight }}</span>`,
                setup(props: any) {
                  return {
                    disassemblePieceTotalWeight: Number(
                      (
                        props.params.data.disassemblePieceNum * props.params.data.pieceWeight
                      ).toFixed(2)
                    ),
                  }
                },
              },
            },
            {
              headerName: '散件/个数',
              field: 'disassembleBulkCount',
              dataIndex: 'disassembleBulkCount',
              width: 200,
            },
            {
              headerName: '总重量',
              field: 'disassembleWeight',
              dataIndex: 'disassembleWeight',
              width: 200,
            },

            {
              headerName: '散件/件数',
              field: 'disassembleBulkNumber',
              dataIndex: 'disassembleBulkNumber',
              width: 200,
            },
            {
              headerName: '散件/散重',
              field: 'disassembleBulkWeight',
              dataIndex: 'disassembleBulkWeight',
              width: 200,
            },
          ],
        },
        {
          headerName: '已拆纱',
          children: [
            {
              headerName: '整件/件数',
              field: 'returnStockPieceNum',
              dataIndex: 'returnStockPieceNum',
              width: 200,
            },
            {
              headerName: '整件/总重量',
              field: 'returnStockPieceTotalWeight',
              dataIndex: 'returnStockPieceTotalWeight',
              width: 200,
              cellRenderer: {
                template: `<span>{{ returnStockPieceTotalWeight }}</span>`,
                setup(props: any) {
                  return {
                    returnStockPieceTotalWeight: Number(
                      (
                        props.params.data.pieceWeight * props.params.data.returnStockPieceNum
                      ).toFixed(2)
                    ),
                  }
                },
              },
            },
            {
              headerName: '散件/件数',
              field: 'returnStockBulkNumber',
              dataIndex: 'returnStockBulkNumber',
              width: 200,
            },
            {
              headerName: '散件/个数',
              field: 'returnStockBulkCount',
              dataIndex: 'returnStockBulkCount',
              width: 200,
            },
            {
              headerName: '散件/散重',
              field: 'returnStockBulkWeight',
              dataIndex: 'returnStockBulkWeight',
              width: 200,
            },
            {
              headerName: '总重量',
              field: 'returnStockWeight',
              dataIndex: 'returnStockWeight',
              width: 200,
            },
          ],
        },
        {
          headerName: '退库',
          children: [
            {
              headerName: '整件/件数',
              field: 'unDisassemblePieceNum',
              width: 200,
              fixed: 'right',
              cellRenderer: inputRender,
              cellRendererParams: {
            maxNumberKey: 'maxUnDisassemblePieceNum',
          },
              valueSetter: (params: any) => {
                let newValue = params.newValue
                params.data.unDisassemblePieceNum = newValue
                console.log(newValue)
               nextTick(()=>{
                params.data.unDisassemblePieceTotalWeight = (
                  params.data.unDisassemblePieceNum * params.data.pieceWeight
                ).toFixed(2)
                params.data.unDisassembleTotalWeight = (
                  newValue * params.data.pieceWeight +
                  params.data.unDisassembleBulkWeight
                ).toFixed(2)
               })
                return true
              },
            },
            {
              headerName: '整件/总重量',
              field: 'unDisassemblePieceTotalWeight',
              width: 200,
              fixed: 'right',
              valueGetter: (params) => {
                return Number(Number(params.data.unDisassemblePieceNum) * Number(params.data.pieceWeight)).toFixed(2)
              },
            },
            {
              headerName: '散件/件数',
              field: 'unDisassembleBulkNumber',
              width: 200,
              fixed: 'right',
              cellRenderer: inputRender,
              cellRendererParams: {
            maxNumberKey: 'maxUnDisassembleBulkNumber',
          },
              valueSetter: (params: any) => {
                let newValue = params.newValue
                params.data.unDisassembleBulkNumber = newValue
                console.log(newValue)
                if (newValue == 0) {
                  params.data.unDisassembleBulkWeight = 0
                  
                }
                if (
                  newValue ==
                  parseFloat(
                    params.data.bulkNumber -
                      params.data.disassembleBulkNumber -
                      params.data.returnStockBulkNumber
                  )
                ) {
                  params.data.unDisassembleBulkWeight.value = parseFloat(
                    params.data.bulkWeight -
                      params.data.disassembleBulkWeight -
                      params.data.returnStockBulkWeight
                  )
                  
                }
               nextTick(()=>{
                params.data.unDisassemblePieceTotalWeight = (
                  params.data.unDisassemblePieceNum * params.data.pieceWeight
                ).toFixed(2)
                params.data.unDisassembleTotalWeight = (
                  params.data.unDisassemblePieceNum * params.data.pieceWeight +
                   params.data.unDisassembleBulkWeight
                ).toFixed(2)
               })
                return true
              },
            },
            {
              headerName: '散件/个数',
              field: 'unDisassembleBulkCount',
              width: 200,
              fixed: 'right',
              cellRenderer: inputRender,
              cellRendererParams: {
              maxNumberKey: 'maxUnDisassembleBulkCount',
              },
              valueSetter: (params: any) => {
                let newValue = params.newValue
                params.data.unDisassembleBulkCount = newValue
                return true
              },
            },
            {
              headerName: '散件/散重',
              field: 'unDisassembleBulkWeight',
              width: 200,
              fixed: 'right',
              cellRenderer: inputRender,
              cellRendererParams: {
              maxNumberKey: 'maxUnDisassembleBulkWeight',
            },
              valueSetter: (params: any) => {
                let newValue = params.newValue
                params.data.unDisassembleBulkWeight = newValue 
                if (newValue == 0) {
                  params.data.unDisassembleBulkNumber = 0
                }
                if (
                  newValue ==
                  parseFloat(
                    params.data.bulkWeight -
                      params.data.disassembleBulkWeight -
                      params.data.returnStockBulkWeight
                  )
                ) {
                  params.data.unDisassembleBulkNumber = parseFloat(
                    params.data.bulkNumber -
                      params.data.disassembleBulkNumber -
                      params.data.returnStockBulkNumber
                  )
                }
               nextTick(()=>{
                params.data.unDisassemblePieceTotalWeight = Number((
                  params.data.unDisassemblePieceNum * params.data.pieceWeight
                ).toFixed(2))
                params.data.unDisassembleTotalWeight = Number((
                  params.data.unDisassemblePieceNum * params.data.pieceWeight +newValue
                ).toFixed(2))
               })
                return true
              },
            },
            {
              headerName: '总重量',
              field: 'unDisassembleTotalWeight',
              width: 200,
              fixed: 'right',
              valueGetter: (params) => {
                return  Number((
                      params.data.unDisassemblePieceNum * params.data.pieceWeight +
                        params.data.unDisassembleBulkWeight
                    ).toFixed(2))
              },
            
            },
          ],
        },
        {
          headerName: '单位',
          field: 'unit',
          dataIndex: 'unit',
          width: 200,
        },
        {
          headerName: '备注',
          field: 'remark',
          dataIndex: 'remark',
          width: 200,
        },
      ]

      let configaggrid2 = ref({
        url: '', //接口路径
        queryData: {
          //接口参数
        },
        paginationShow: false, //分页是否显示
        invokeiIterface: false, //是否调用接
        rowMultiSelectWithClick: true, //点击行是否多选
        column: tableColumns2,
        fileName: 'yscckMaterialRequisitioToBeProcessed2',
      })
      //拆纱单号下拉框查询
      function selCxAll(val: any) {
        if (searchData.wh == '' || searchData.firm == '') {
          Message.error('请先选择仓库和公司')
          return
        } else if (isIDs.value == 2) {
          post({
            url: 'planSingle/disassembleOrder/getDisassembleFieldValue',
            data: val,
          }).then(({ data, code }: any) => {
            if (code === 200) {
              pageData.dropDownList = data
            } else {
              Message.error({
                content: '查询失败！',
                duration: 5000,
              })
            }
          })
        } else {
          post({
            url: 'planSingle/planMaterial/getFieldValueByWarehouse',
            data: val,
          }).then(({ data, code }: any) => {
            if (code === 200) {
              pageData.dropDownList = data
            } else {
              Message.error({
                content: '查询失败！',
                duration: 5000,
              })
            }
          })
        }
      }

      // 补打纱飞下拉框查询
      function selCxAll1(val: any) {
        if (isIDs.value == 2) {
          post({
            url: 'planSingle/disassembleOrder/getSaFeiPrintNum',
            data: val,
          }).then(({ data, code }: any) => {
            if (code === 200) {
              pageData.dropDownList = data
            }
          })
        }
      }

      onMounted(() => {
        doRefresh()
        pageData.startDate = dayjs().format('YYYY-MM-DD')
        pageData.endDate = dayjs().format('YYYY-MM-DD')
      })
      let isIDs: any = ref(1)
      // 已处理分页查询
      const selectHandler1 = () => {
        pagination2.page = 1
        loadings.value = true
        doRefresh2()
      }
      // 未处理分页查询
      const selectHandler = () => {
        pagination.page = 1
        loadings.value = true
        doRefresh()
      }

      const selectHandler2 = () => {
        pagination3.page = 1
        loadings.value = true
        doRefresh3()
      }

      const selectHandler3 = () => {
        pagination4.page = 1
        loadings.value = true
        doRefresh4()
      }
      // const selectHandler4 = () => {
      //   pagination3.page = 1
      //   loadings.value = true
      //   doRefresh4()
      // }

      let loadings = ref(false)

      // 一表格准备事件
      const gridOption = ref()
      const colState = ref()
      const gridReady = (params: any) => {
        gridOption.value = params.api
        colState.value = params.columnApi
      }
      // 二表格准备事件
      const gridOption2 = ref()
      const colState2 = ref()
      const gridReady2 = (params: any) => {
        gridOption2.value = params.api
        colState2.value = params.columnApi
      }
      // 三表格准备事件
      const gridOption3 = ref()
      const colState3 = ref()
      const gridReady3 = (params: any) => {
        gridOption3.value = params.api
        colState3.value = params.columnApi
      }
      // 四表格准备事件
      const gridOption4 = ref()
      const colState4 = ref()
      const gridReady4 = (params: any) => {
        gridOption4.value = params.api
        colState4.value = params.columnApi
      }

      const gridOptionAdd = ref()
      const gridReadyAdd = (params: any) => {
        gridOptionAdd.value = params.api
      }

      //已处理 未处理tab切换
      const changeTabs = (val: any) => {
        isIDs.value = val
        console.log(isIDs.value)

        pageData.disassembleCode = ''
        pageData.rawmaterialCode = ''
        pageData.greyCode = ''
        pageData.planOrderCode = ''
        pageData.orderNo = ''
        pageData.planNeedCode = ''

        if (isIDs.value == 1) {
          pageData.dutymachineState = 0
          doRefresh()
        } else if (isIDs.value == 2) {
          pageData.dutymachineState = 1
          doRefresh2()
        } else if (isIDs.value == 3) {
          doRefresh3()
        } else {
          doRefresh4()
        }
      }

      //获取公司部门组列表
      const defaultColDef = {
        sortable: true,
        resizable: true,
        filter: true,
        // flex: 1
      }

      const whList = ref<any[]>([])
      const whService = new WHService()
      const whTypeList = whService.whTypeList
      const whTypeFieldList = whService.whTypeFieldList
      const companyList: any = whService.companyList
      const searchData = reactive<{
        whTypeName: string
        firm: string
        wh: string
        stats: any
      }>({
        firm: '',
        whTypeName: '',
        wh: '',
        stats: '',
      })
      // 公司下拉框 改变
      const companyChange = (val: any) => {
        whList.value = []
        searchData.wh = ''
        whService.getWarhouseList(val, '原纱仓')
      }
      const changeOption = (val: any) => {
        numList.printLs = ''
      }
      watch(
        () => whService.whList.value,
        (o, n) => {
          whList.value = whService.whList.value
        }
      )
      // 一表生成拆纱单
      const cjcsds = () => {
        if (isIDs.value == 1) {
          if (gridOption.value.getSelectedRows().length != 1) {
            Message.warning('请勾选一条数据！')
            return
          }
          let list = gridOption.value.getSelectedRows()
          pageData.showAdd_cjcsd = true
          doRefresh_son()
          for (let key in list[0]) {
            if (
              key == 'pieceNumber' ||
              key == 'weightPieceTotal' ||
              key == 'bulkNumber' ||
              key == 'bulkCount' ||
              key == 'bulkWeight' ||
              key == 'weightTotal'
            ) {
              continue
            }
            dataForm[key] = list[0][key]
          }
          var ob = list[0]
          dataForm.orderType = 0
          dataForm.pieceNumber = parseFloat(ob.unDisassemblePieceNum)
          dataForm.weightPieceTotal = Number((ob.unDisassemblePieceNum * ob.pieceWeight).toFixed(2))
          dataForm.bulkNumber = parseFloat(ob.unDisassembleBulkNumber)
          dataForm.bulkCount = Number(
            (ob.bulkCount - ob.returnStockBulkCount - ob.disassembleBulkCount).toFixed(2)
          )
          dataForm.bulkWeight = Number(
            (ob.bulkWeight - ob.returnStockBulkWeight - ob.disassembleBulkWeight).toFixed(2)
          )
          dataForm.weightTotal = Number(
            (ob.weightTotal - ob.disassembleWeight - ob.returnStockWeight).toFixed(2)
          )
        }
      }
      // 创建拆纱单保存按钮
      const sideOk = () => {
        var total_disassembleWeight = 0
        pageData.cfList.forEach(function (o) {
          total_disassembleWeight += o.disassembleWeight
        })
        for (let i = 0; i < pageData.cfList.length; i++) {
          if (pageData.cfList[i].disassembleWeight == 0) {
            Message.warning({
              content: '分配总重量不能为0!',
              duration: 5000,
            })
            return
          }
          if (pageData.cfList[i].caseNumber == 0 || pageData.cfList[i].caseNumber == null) {
            Message.warning({
              content: '箱数不能为0!',
              duration: 5000,
            })
            return
          }
        }
        if (total_disassembleWeight == 0) {
          Message.warning({
            content: '请分配需要拆纱的数量!',
            duration: 5000,
          })
          return
        }
        post({
          url: '/planSingle/disassembleOrder/createDisassembleOrder',
          data: {
            orderDetail: gridOption.value.getSelectedRows(),
            needDetail: [...pageData.cfList, ...addDwDelRows.value],
            orderType: dataForm.orderType,
          },
        })
          .then((res: any) => {
            if (res.code === 200) {
              // formRef.value?.resetFields();
              pageData.showAdd_cjcsd = false
              Message.success({
                content: '新增成功',
                duration: 5000,
              })
            } else {
              Message.error({
                content: res.message,
                duration: 5000,
              })
            }
          })
          .finally(() => {
            doRefresh()
            pageData.pageLoading = false
          })
      }

      const scrollbar = ref(true)
      let visiblecg = ref(false)
      let visiblecg1 = ref(false)
      let visiblecg2 = ref(false)
      let visiblecg3 = ref(false)
      let visiblecg5 = ref(false)
      let visiblecg6 = ref(false)
      let qrModal = ref<ModalDialogType | null>(null)
      let idDtaDy: any = ref({
        printNum: '',
      })
      let idDtaDys: any = ref({})
      let idDtaDys1: any = ref({})
      let idDtaDyss: any = ref([{}])
      // 打印拆纱单按钮
      const print = () => {
        printJS({
          printable: 'dyy1',
          type: 'html',
          style: '@media print{ @page { size: 5.7cm 15cm; margin: 0; } }',
          targetStyles: ['*'],
        })
      }
      // 打印纱飞按钮
      const print1 = () => {
        var printWindow: any = window.open('', '', 'width=600,height=600')
        printWindow.document.open()

        // 在打印窗口中创建打印内容
        printWindow.document.write('<html><head><title>Print</title></head><body>')

        idDtaDys1.value.forEach((item: any) => {
          printWindow.document.write(
            '<div style="width: 200px;height: 500px;page-break-before: always;">'
          )
          printWindow.document.write(`
          <div style="margin: 100px auto;width: 130px;height: 60px;border: 1px solid black;border-radius: 60%;"></div>
          <table style="width: 100%;margin: 0 auto;border: 1.2px solid #000;text-align: center;border-collapse: collapse;margin-top:20px">
              <tr>
                <td style="border: 1.2px solid #000; height: 30px;" colspan="4">${item.company}</td>
              </tr>
              <tr>
                <td style="width: 50px;font-size: 12px; height: 30px;">单号</td>
                <td colspan="2" style="font-size: 12px;border: 1.2px solid #000; height: 30px;">${item.planOrderCode}</td>
                <td style="font-size: 12px;border: 1.2px solid #000; height: 30px;">${item.printTime}</td>
              </tr>
              <tr>
                <td style="font-size: 12px;height: 70px;border: 1.2px solid #000; height: 30px;">原料名称</td>
                <td colspan="3" style="font-size: 18px;border: 1.2px solid #000; height: 30px;">${item.rawmaterialName}</td>
              </tr>
              <tr>
                <td style="font-size: 12px;height: 45px;border: 1.2px solid #000; height: 30px;">色号色称</td>
                <td colspan="3" style="font-size: 18px;border: 1.2px solid #000; height: 30px;">${item.colorCode}/${item.colorName}</td>
              </tr>
              <tr>
                <td style="font-size: 12px;height: 30px;border: 1.2px solid #000; height: 30px;">品牌</td>
                <td colspan="3" style="font-size: 18px;border: 1.2px solid #000; height: 30px;">${item.brandName}</td>
              </tr>
              <tr>
                <td style="font-size: 12px;height: 45px;border: 1.2px solid #000; height: 30px;">批次</td>
                <td colspan="3" style="font-size: 18px;border: 1.2px solid #000; height: 30px;">${item.yarnBatch}</td>
              </tr>
              <tr>
                <td style="font-size: 12px;height: 45px;width: 45px;border: 1.2px solid #000; height: 30px;">位置</td>
                <td style="font-size: 16px;width: 63px;border: 1.2px solid #000; height: 30px;">${item.coordinate}</td>
                <td style="font-size: 12px;height: 45px;width: 45px;border: 1.2px solid #000; height: 30px;"><b>机台</b></td>
                <td style="width: 63px;font-size:18px;font-weight:800;border: 1.2px solid #000; height: 30px;">${item.machineCode}</td>
              </tr>
            </table>
            <div style="margin-bottom: 50px;">
              <h4 style="margin: 2px;">楼层: <span>${item.areaName}</span></h4>
              <h4 style="margin: 2px;">纱飞单号: <span>${item.disassembleCode}</span></h4>
              <h4 style="margin: 2px;">机位序号: <span>${item.coordinate}#${item.ls}</span></h4>
              <h4 style="margin: 2px;">备注: <span>${item.needRemark}</span></h4>
              <h3 style="text-align: center;margin-top: 10px;">巨丰</h4>
              <div style="height: 15px;border-bottom: 1px dashed black;margin-bottom: 20px;padding:15px auto;"></div>
              <div style="height: 45px;border-bottom: 1px dashed #fff;margin-bottom: 20px;"></div>
            </div>
      `)
          printWindow.document.write('</div>')
        })

        printWindow.document.write('</body></html>')
        printWindow.document.close()

        // 打印
        printWindow.print()

        // 关闭打印窗口
        printWindow.close()
      }
      const prints = () => {
        visiblecg1.value = false
        visiblecg3.value = true
        idDtaDys1.value = []
        //发请求
        idDtaDys2.value.forEach((o: any) => {
          o.id = parseInt(o.id)
        })
        post({
          url: 'planSingle/disassembleOrder/printSaFei',
          data: idDtaDys2.value,
        }).then(({ code, data, message }: any) => {
          if (code === 200) {
            //{001：[]}
            if (Object.keys(data).length != 0) {
              idDtaDys1.value = data
            }

            visiblecg1.value = false
            visiblecg3.value = true
          }
        })
      }
      // 补打纱飞按钮
      const print2 = () => {
        // visiblecg5.value = false
        // visiblecg6.value = true
        printJS({
          printable: 'dyy5',
          type: 'html',
          targetStyles: ['*'],
        })
      }
      const prints2 = () => {
        var isListArray: any = []
        for (let item in pageData.list1) {
          isListArray.push(pageData.list1[item])
        }
        idDtaDys3.value.forEach(function (o: any) {
          o['printLs'] = String(isListArray)
        })
        //发请求
        idDtaDys3.value.forEach((o: any) => {
          o.id = parseInt(o.id)
        })
        post({
          url: 'planSingle/disassembleOrder/patchPrintSaFei',
          data: idDtaDys3.value,
        }).then(({ code, data, message }: any) => {
          if (code === 200) {
            //{001：[]}
            if (Object.keys(data).length != 0) {
              // idDtaDyss.value = data
              idDtaDys1.value = data
            }
            visiblecg5.value = false
            // visiblecg6.value = true
            visiblecg1.value = true
          }
        })
      }
      const gbModal = () => {
        qrModal.value?.toggle()
      }

      const printList = ref([])
      // 二表打印拆纱单
      const dycsds = (item: any) => {
        if (gridOption2.value.getSelectedRows().length <= 0) {
          Message.error('请勾选一条行数据！')
          return
        }
        //1 拿到后段需要的传参
        let list: any = []
        // idDtaDys.value = []
        gridOption2.value.getSelectedRows().forEach(function (o: any) {
          if (!list.includes(o['disassembleCode'])) {
            list.push(o['disassembleCode'])
          }
        })
        // printPdf(list)
        //发请求
        post({
          url: 'planSingle/disassembleOrder/printDisassemble',
          data: list,
        }).then(({ code, data, message }: any) => {
          if (code === 200) {
            console.log(data)
            printList.value = data
            visiblecg.value = true
          }
        })
      }

      const pirintSplitSheet = () => {
        printJS({
          printable: 'jitdy',
          type: 'html',
          targetStyles: ['*'],
          font_size: '12',
        })
      }

      //打印预览PDF
      const printPdf = (e: any) => {
        post({
          url: 'planSingle/disassembleOrder/printDisassemble',
          data: e,
          responseType: 'blob',
        }).then((res: any) => {
          let reader = new FileReader()
          reader.readAsDataURL(res)
          reader.onload = function () {
            let pdfBase64 = reader.result.replace('data:application/pdf;base64,', '')
            printJS({ printable: pdfBase64, type: 'pdf', base64: true })
          }
        })
      }
      let idDtaDys2: any = ref([])
      // 二表打印纱飞
      const dysfs = () => {
        if (gridOption2.value.getSelectedRows().length == 0) {
          Message.error('请先勾选')
          visiblecg1.value = false
        } else {
          idDtaDys1.value = []
          idDtaDys2.value = []
          gridOption2.value.getSelectedRows().forEach(function (o: any) {
            let uidd = {}
            uidd['planOrderCode'] = o.planOrderCode
            uidd['rawmaterialCode'] = o.rawmaterialCode
            uidd['machineCode'] = o.machineCode
            uidd['planNeedCode'] = o.planNeedCode
            uidd['id'] = parseInt(o.id)
            uidd['caseNumber'] = o.caseNumber
            uidd['printNum'] = o.caseNumber
            idDtaDys2.value.push(uidd)
          })
          post({
            url: 'planSingle/disassembleOrder/printSaFei',
            data: idDtaDys2.value,
          }).then(({ code, data, message }: any) => {
            if (code === 200) {
              if (Object.keys(data).length != 0) {
                idDtaDys1.value = data
              }
              console.log(idDtaDys1.value[0].needRemark)
              pageData.titleOPen = ' 打印纱飞单'
              visiblecg1.value = true
            }
          })
        }
      }

      let cascaderRef = ref('')
      let configCascader = ref<{}>({
        corporateWidth: '180px', //公司宽度
        sectorWidth: '180px', //部门宽度
        corporateRquired: false, //公司是否必填
        sectorRquired: false, //部门是否必填
        size: 'mini', //选择框大小'mini' | 'small' | 'medium' | 'large'
        corporateName: '选择公司', //公司label
        sectorName: '选择部门', //部门label
        cascaderShow: 'sector', //配置部门不显示
      })
      const changeCascader = (data: any) => {
        const { corporateId } = data
        whList.value = []
        searchData.wh = ''
        searchData.firm = corporateId
        whService.getWarhouseList(corporateId, '原纱仓')
      }
      // 二表补打纱飞
      const idDtaDys3: any = ref([])
      const bdsfs = () => {
        if (gridOption2.value.getSelectedRows().length == 0) {
          Message.error('请先勾选')
        } else {
          idDtaDys3.value = []
          gridOption2.value.getSelectedRows().forEach(function (o: any) {
            let uidd: any = {}
            uidd['planOrderCode'] = o.planOrderCode
            uidd['rawmaterialCode'] = o.rawmaterialCode
            uidd['machineCode'] = o.machineCode
            uidd['planNeedCode'] = o.planNeedCode
            uidd['id'] = o.id
            uidd['printLs'] = ''
            idDtaDys3.value.push(uidd)
          })
          visiblecg5.value = true
        }
      }
      let numList: any = ref([])
      const focusNum = () => {
        numList.value = []

        let list = pageData.clothList.map(function (o: any) {
          return o.saFeiPrintNum
        })

        for (let i = 1; i <= list[0]; i++) {
          let ob: any = {}
          ob['printLs'] = i
          ob['id'] = gridOption2.value.getSelectedRows().map((o: any) => {
            return o.id
          }).value
          numList.value.push(ob)
        }

        // }
      }
      //下拉框得到焦点
      const focusSelsf = () => {
        selCxAllsf(
          gridOption2.value.getSelectedRows().map((o: any) => {
            return o.id
          })
        )
      }
      //下拉数据
      // const optionssf = ref<any>(pageData.clothList);
      // const loadingsf = ref(false);

      // const handleSearchsf = (value: any) => {
      //     if (value) {
      //         // const ob = gridOption2.value.getSelectedRows().map((o: any) => { return o.id })
      //         const ob = { "saFeiPrintNum": value }
      //         loadingsf.value = true;
      //         selCxAllsf(ob);
      //         optionssf.value = pageData.clothList;
      //         loadingsf.value = false;

      //     } else {
      //         optionssf.value = []
      //     }
      // };

      const localeText1: any = ref(localeText)

      //下拉框查询
      function selCxAllsf(val: any) {
        post({
          url: 'planSingle/disassembleOrder/getSaFeiPrintNum',
          data: val,
        }).then(({ data, code }: any) => {
          if (code === 200) {
            pageData.clothList = data
            focusNum()
          } else {
            Message.error({
              content: '查询失败！',
              duration: 5000,
            })
          }
        })
      }
      const pagingList1: any = ref(pagingList)

      // 子表分配件数的失焦事件
      const changeTable = (record: any) => {
        if (
          record.disassemblePieceNum == '' ||
          record.disassemblePieceNum == undefined ||
          record.disassemblePieceNum == null
        ) {
          record['disassemblePieceNum'] = 0
        }

        if (record.disassemblePieceNum == 0) {
          record.disassembleBulkCount = 0
          record.disassembleBulkNumber = 0
          record.disassembleBulkWeight = 0
        }
        if (record.disassemblePieceNum >= Number(dataForm.pieceNumber)) {
          record.disassembleBulkCount = dataForm.bulkCount
          record.disassembleBulkNumber = dataForm.bulkNumber
          record.disassembleBulkWeight = dataForm.bulkWeight
        }
        var tempNum = 0
        pageData.cfList.forEach(function (o) {
          tempNum += parseFloat(o['disassemblePieceNum'])
        })
        if (tempNum > parseFloat(dataForm['pieceNumber'])) {
          Message.error({
            content: '分配件数之和不能超过出库总件数！',
            duration: 5000,
          })
          record['disassemblePieceNum'] = 0
          record['disassembleBulkNumber'] = 0
          record['disassembleBulkWeight'] = 0
        }
        // 计算总重量 record.disassembleWeight =
        record.disassembleWeight = (
          record.disassembleBulkWeight +
          record.pieceWeight * record.disassemblePieceNum
        ).toFixed(2)
        record.caseNumber = record.disassemblePieceNum
        // if (
        //   record.disassembleWeight + parseFloat(record['allotWeight']) >
        //   parseFloat(record['needWeight'])
        // ) {
        //   Message.error({
        //     content: '分配重量+已分配重量不可大于领料重量.',
        //     duration: 5000,
        //   })
        //   nextTick(() => {
        //     record['disassemblePieceNum'] = Number(0)
        //   })
        //   return
        // }
        setTimeout(() => {
          gridOptionAdd.value.setRowData(pageData.cfList)
        }, 500)
      }
      //设置权限
      // ['查询', '新增', '删除', '导出', '导入']
      const permissionStore = usePermission()

      if (permissionStore.hasPermisson('cs.dclcx')) {
        pageData.btnList.push('查询')
        pageData.btnList1.push('导出')
      }
      if (permissionStore.hasPermisson('cs.yclcx')) {
        pageData.btnList1.push('查询')
      }
      if (permissionStore.hasPermisson('cs.cjcsd')) {
        pageData.btnList.push('创建拆纱单')
      }
      if (permissionStore.hasPermisson('cs.dycsd')) {
        pageData.btnList1.push('打印拆纱单')
      }

      if (permissionStore.hasPermisson('cs.dysf')) {
        pageData.btnList1.push('打印纱飞')
      }
      if (permissionStore.hasPermisson('cs.bdsf')) {
        pageData.btnList1.push('补打纱飞')
      }
      if (permissionStore.hasPermisson('cs.ktkcx')) {
        pageData.btnList2.push('查询')
      }
      if (permissionStore.hasPermisson('cs.ktktk')) {
        pageData.btnList2.push('退库')
      }
      if (permissionStore.hasPermisson('cs.tkjlcx')) {
        pageData.btnList3.push('查询')
      }

      //分配散件散重 改变
      function changeDbw(record: any) {
        ////debugger
        if (
          record.disassembleBulkWeight == '' ||
          record.disassembleBulkWeight == undefined ||
          record.disassembleBulkWeight == null
        ) {
          record['disassembleBulkWeight'] = 0
        }

        // 计算总重量 record.disassembleWeight =
        var tempWeight =
          parseFloat(record['disassembleBulkWeight']) +
          parseFloat(record.pieceWeight) * parseFloat(record.disassemblePieceNum)
   
        if (record.disassembleBulkWeight == 0) {
          record.disassembleBulkCount = 0
          record.disassembleBulkNumber = 0
          record.disassemblePieceNum = 0
          record.disassembleWeight = 0
        }
        if (record.disassembleBulkWeight >= Number(dataForm.bulkWeight)) {
          record.disassembleBulkCount = dataForm.bulkCount
          record.disassembleBulkNumber = dataForm.bulkNumber
          record.disassembleBulkWeight = dataForm.bulkWeight
        }

        let num = 0
        pageData.cfList.forEach(function (o: any) {
          num += parseFloat(o['disassembleBulkWeight'])
        })
        if (num > parseFloat(dataForm.bulkWeight)) {
          Message.error({
            content: '分配散件散重之和不能超过散件散重！',
            duration: 5000,
          })
          record.disassembleBulkWeight = 0
          record['disassembleBulkWeight'] = 0
          return
        }
        record.disassembleWeight = (
          record.disassembleBulkWeight +
          record.pieceWeight * record.disassemblePieceNum
        ).toFixed(2)
        record.caseNumber = record.disassemblePieceNum
        setTimeout(() => {
          gridOptionAdd.value.setRowData(pageData.cfList)
        }, 500)
      }

      function changeDbn(record: any) {
        
        if (
          record.disassembleBulkNumber == '' ||
          record.disassembleBulkNumber == undefined ||
          record.disassembleBulkNumber == null
        ) {
          record.disassembleBulkNumber = 0
        }

        if (record.disassembleBulkNumber == 0) {
          record.disassembleBulkCount = 0
          record.disassemblePieceNum = 0
          record.disassembleBulkWeight = 0
          record.disassembleWeight = 0
        }
        if (record.disassembleBulkNumber >= Number(dataForm.bulkNumber)) {
          record.disassembleBulkCount = dataForm.bulkCount
          record.disassemblePieceNum = dataForm.pieceNumber
          record.disassembleBulkWeight = dataForm.bulkWeight
        }
       
        let num = 0
        pageData.cfList.forEach(function (o: any) {
          num += parseFloat(o['disassembleBulkNumber'])
        })
        if (num > parseFloat(dataForm.bulkNumber)) {
          Message.error({
            content: '分配散件件数之和不能超过散件件数！',
            duration: 5000,
          })
          record.disassembleBulkNumber = 0
          // return
        }
        record.disassembleWeight = (
          record.disassembleBulkWeight +
          record.pieceWeight * record.disassemblePieceNum
        ).toFixed(2)
        record.caseNumber = record.disassemblePieceNum
        setTimeout(() => {
          gridOptionAdd.value.setRowData(pageData.cfList)
        }, 500)
      }
      function changeDbc(record: any) {
        if (
          record.disassembleBulkCount == '' ||
          record.disassembleBulkCount == undefined ||
          record.disassembleBulkCount == null
        ) {
          record.disassembleBulkCount = 0
        }

        let num = 0
        pageData.cfList.forEach(function (o: any) {
          num += parseFloat(o['disassembleBulkCount'])
        })
        if (num > parseFloat(dataForm.bulkCount)) {
          Message.error({
            content: '分配散件个数之和不能超过散件个数！',
            duration: 5000,
          })
          record.disassembleBulkCount = 0
          // return
        }
        if (record.disassembleBulkCount == 0) {
          record.disassembleBulkNumber = 0
          record.disassemblePieceNum = 0
          record.disassembleBulkWeight = 0
          record.disassembleWeight = 0
        }
        if (record.disassembleBulkCount >= Number(dataForm.bulkCount)) {
          record.disassembleBulkNumber = dataForm.bulkNumber
          record.disassemblePieceNum = dataForm.pieceNumber
          record.disassembleBulkWeight = dataForm.bulkWeight
        }
        record.disassembleWeight = (
          record.disassembleBulkWeight +
          record.pieceWeight * record.disassemblePieceNum
        ).toFixed(2)
        record.caseNumber = record.disassemblePieceNum

        setTimeout(() => {
          gridOptionAdd.value.setRowData(pageData.cfList)
        }, 500)
      }

      const { saveGridState: saveGridState01, updateGridState: updateGridState01 } =
        saveOrUpdateGridState01('YarnStripPingDatas-1', gridOption, colState, tc1)
      const onColumnMoved = () => {
        saveGridState01()
      }
      const onColumnResized = () => {
        saveGridState01()
      }
      const onColumnVisible = () => {
        saveGridState01()
      }
      const { saveGridState: saveGridState02, updateGridState: updateGridState02 } =
        saveOrUpdateGridState02('YarnStripPingDatas-2', gridOption2, colState2, tc2)
      const onColumnMoved2 = () => {
        saveGridState02()
      }
      const onColumnResized2 = () => {
        saveGridState02()
      }
      const onColumnVisible2 = () => {
        saveGridState02()
      }
      const { saveGridState: saveGridState03, updateGridState: updateGridState03 } =
        saveOrUpdateGridState02('YarnStripPingDatas-3', gridOption3, colState3, tc3)
      const onColumnMoved3 = () => {
        saveGridState03()
      }
      const onColumnResized3 = () => {
        saveGridState03()
      }
      const onColumnVisible3 = () => {
        saveGridState03()
      }
      const { saveGridState: saveGridState04, updateGridState: updateGridState04 } =
        saveOrUpdateGridState02('YarnStripPingDatas-4', gridOption4, colState4, tc4)
      const onColumnMoved4 = () => {
        saveGridState04()
      }
      const onColumnResized4 = () => {
        saveGridState04()
      }
      const onColumnVisible4 = () => {
        saveGridState04()
      }
      const exports = () => {
        post({
          url: '/planSingle/disassembleOrder/getExportExcel',
          data: {
            deleteState: 0,
            warehouseId: searchData.wh,
            firmId: searchData.firm,
            disassembleCode: pageData.disassembleCode,
            rawmaterialCode: pageData.rawmaterialCode,
            greyCode: pageData.greyCode,
            planOrderCode: pageData.planOrderCode,
            orderNo: pageData.orderNo,
            planNeedCode: pageData.planNeedCode,
            startDate: pageData.startDate,
            endDate: pageData.endDate,
          },
        }).then(({ data, code }: any) => {
          if (code === 200) {
            EXELTABLE(tc2, data, '拆纱')
          }
        })
      }

      const DeleteClick = () => {
        console.log(gridOptionAdd.value.getSelectedRows())
        // let tempFlags = gridOptionAdd.value
        //   .getSelectedRows()
        //   .map((item: any) => item.planNeedCode + '-' + item.machineCode)
        let tempFlags = gridOptionAdd.value.getSelectedRows().map((item: any) => item.needDetailId)
        const newArr: any = []
        pageData.cfList.forEach((res) => {
          // let tempFlag = res.planNeedCode + '-' + res.machineCode
          let tempFlag = res.needDetailId
          if (tempFlags.includes(tempFlag)) {
            //被删除的行
            res.disassembleWeight = 0
            res.caseNumber = 0
            res.disassembleBulkWeight = 0
            res.disassembleBulkNumber = 0
            res.disassemblePieceNum = 0
            addDwDelRows.value.push(res)
          } else {
            //未被删除的数据
            newArr.push(res)
          }
        })
        pageData.cfList = newArr
        setTimeout(() => {
          gridOptionAdd.value.setRowData(pageData.cfList)
        }, 0)
      }

      //底部合计行
      function createTotalRow() {
        var sum1 = 0
        var sum2 = 0
        var sum3 = 0
        var sum4 = 0
        var sum5 = 0
        var sum6 = 0
        var sum7 = 0
        var sum8 = 0
        var sum9 = 0
        var sum10 = 0
        var sum11 = 0
        var sum12 = 0
        var sum13 = 0
        var sum14 = 0
        var sum15 = 0
        var sum16 = 0
        var sum17 = 0
        var sum18 = 0
        if (isIDs.value == 1 || isIDs.value == 3 || isIDs.value == 4) {
          for (var i = 0; i < table.dataList.length; i++) {
            sum1 = sum1 + table.dataList[i].pieceNumber
            sum2 = sum2 + table.dataList[i].pieceWeight
            sum3 = sum3 + table.dataList[i].bulkNumber
            sum4 = sum4 + table.dataList[i].bulkWeight
            sum5 = sum5 + table.dataList[i].weightTotal
            sum6 = sum6 + table.dataList[i].disassemblePieceNum
            sum7 = sum7 + table.dataList[i].disassembleWeight
            sum8 = sum8 + table.dataList[i].unDisassemblePieceNum
            sum9 = sum9 + table.dataList[i].disassembleBulkNumber
            sum10 = sum10 + table.dataList[i].disassembleBulkWeight
            sum11 = sum11 + table.dataList[i].unDisassembleBulkNumber
            sum12 = sum12 + table.dataList[i].returnStockBulkCount
            sum13 = sum13 + table.dataList[i].returnStockBulkNumber
            sum14 = sum14 + table.dataList[i].returnStockBulkWeight
            sum15 = sum15 + table.dataList[i].returnStockPieceNum
            sum16 = sum16 + table.dataList[i].returnStockWeight
            sum17 = sum17 + table.dataList[i].returnStockPieceTotalWeight
            sum18 = sum18 + table.dataList[i].disassembleBulkCount
          }
          var nowRows = [
            {
              matchColor: '汇总',
              pieceNumber: sum1.toFixed(2),
              pieceWeight: sum2.toFixed(2),
              bulkNumber: sum3.toFixed(2),
              bulkWeight: sum4.toFixed(2),
              weightTotal: sum5.toFixed(2),
              disassemblePieceNum: sum6.toFixed(2),
              disassembleWeight: sum7.toFixed(2),
              unDisassemblePieceNum: sum8.toFixed(2),
              disassembleBulkNumber: sum9.toFixed(2),
              disassembleBulkWeight: sum10.toFixed(2),
              unDisassembleBulkNumber: sum11.toFixed(2),
              bulkCount: sum12.toFixed(2),
              returnStockBulkCount: sum13.toFixed(2),
              returnStockBulkWeight: sum14.toFixed(2),
              returnStockPieceNum: sum15.toFixed(2),
              returnStockWeight: sum16.toFixed(2),
              returnStockPieceTotalWeight: sum17.toFixed(2),
              disassembleBulkCount: sum18.toFixed(2),
            },
          ]
          gridOption.value.setPinnedBottomRowData(nowRows)
          gridOption3.value.setPinnedBottomRowData(nowRows)
          gridOption4.value.setPinnedBottomRowData(nowRows)
        } else {
          for (var i = 0; i < table.dataList.length; i++) {
            sum1 = sum1 + table.dataList[i].disassemblePieceNum
            sum2 = sum2 + table.dataList[i].disassembleWeight
          }
          var nowRows2 = [
            {
              unit: '汇总',
              disassemblePieceNum: sum1.toFixed(2),
              disassembleWeight: sum2.toFixed(2),
              orderType: '',
            },
          ]
          gridOption2.value.setPinnedBottomRowData(nowRows2)
        }
      }

      return {
        DeleteClick,
        exports,
        saveOrUpdateGridState01,
        saveGridState01,
        updateGridState01,
        onColumnMoved,
        onColumnResized,
        onColumnVisible,
        colState,
        stockDrawOk,
        saveOrUpdateGridState02,
        saveGridState02,
        saveGridState03,
        saveGridState04,
        updateGridState02,
        onColumnMoved2,
        onColumnMoved3,
        onColumnMoved4,
        onColumnResized2,
        onColumnResized3,
        onColumnResized4,
        onColumnVisible2,
        onColumnVisible3,
        onColumnVisible4,
        colState2,
        selectHandler2,
        selectHandler3,
        changeDbw,
        changeDbn,
        changeDbc,
        pagingList1,
        focusSelsf,
        // handleSearchsf,
        changeOption,
        numList,
        focusNum,
        idDtaDys3,
        idDtaDys2,
        // focusSel1,
        idDtaDys1,
        idDtaDyss,
        visiblecg1,
        visiblecg2,
        visiblecg3,
        visiblecg5,
        visiblecg6,
        scrollbar,
        bdsfs,
        localeText1,
        dysfs,
        idDtaDy,
        idDtaDys,
        qrModal,
        dycsds,
        print1,
        prints2,
        print,
        prints,
        print2,
        gbModal,
        cjcsds,
        whTypeList,
        dataForm1,
        isIDs,
        companyList,
        searchData,
        whList,
        companyChange,
        id,
        pagination2,
        defaultColDef,
        tc1,
        tc2,
        tc3,
        tc4,
        gridOption,
        gridOption2,
        gridReady,
        gridReady2,
        gridReady3,
        gridReady4,
        ktktks,
        total,
        dataForm,
        selectedRowKeys,
        s: selectedRowKeysChecked.selectedRowKeys,
        pagination,
        pagination3,
        pagination4,
        tableColumns,
        table,
        rowKey,
        pageData,
        selectHandler,
        selectHandler1,
        changeTabs,
        visiblecg,
        options,
        loading,
        handleSearch,
        handleSearch1,
        handleSearch2,
        handleSearch3,
        handleSearch4,
        handleSearch5,
        focusSel,
        headerShow,
        change1,
        PageSize,
        cascaderRef,
        configCascader,
        changeCascader,
        tableColumnsCf,
        doRefresh_son,
        sideOk,
        changeTable,
        gridOptionAdd,
        gridReadyAdd,
        // tableColumnsCfs,
        printList,
        pirintSplitSheet,
        gridOptionRef2,
        configaggrid2,
      }
    },
    components: {
      Toolbar,
      PageTabelLayout,
      ModalDialog,
      QrcodeVue,
      CorporateSectorCascader,
    },
  }
</script>
<style scoped lang="less">
  #Table td,
  #Table th {
    border: 1px solid #000;
    padding: 10px;
  }

  .tdStyle {
    min-width: 100px;
  }

  .notClick {
    background-color: gray;
    cursor: no-drop;
  }

  .isTable {
    margin-top: 100px;
    width: 90%;
    margin: 0 auto;
    border: 1.2px solid #000;
    text-align: center;
    border-collapse: collapse;

    td {
      border: 1.2px solid #000;
    }

    th {
      border: 1.2px solid #000;
    }
  }

  .isTable1 {
    margin: 50px;
    width: 90%;
    // margin: 0 auto;
    border: 1.2px solid #000;
    text-align: center;
    border-collapse: collapse;

    td {
      border: 1.2px solid #000;
    }

    th {
      border: 1.2px solid #000;
    }
  }

  .dyss {
    margin-bottom: 100px;
    display: flex;
    width: 90%;
    margin: 0 auto;
    justify-content: space-between;
    font-weight: 1000;

    div {
      width: 200px;
    }
  }

  .divTop {
    height: 15px;
    border-bottom: 1px dashed black;
  }

  .divNev {
    margin: 10px auto;
    width: 130px;
    height: 60px;
    // margin-top: 50px;
    border: 1px solid black;
    border-radius: 60%;
  }

  .isTable2 {
    // margin: 50px;
    width: 100%;
    margin: 0 auto;
    border: 1.2px solid #000;
    text-align: center;
    border-collapse: collapse;

    td {
      border: 1.2px solid #000;
      height: 30px;
    }

    th {
      border: 1.2px solid #000;
    }
  }

  .fontColor {
    color: #165dff;
  }

  .print-content {
    position: relative;
    width: 780px;
    height: 540px;
    color: black !important;
    // margin-top: 20px;
    box-sizing: border-box;

    .contentPrint {
      width: 100%;
      display: flex;
      color: black !important;
      font-family: '黑体';
      margin-top: 40px;
    }

    .page-break {
      page-break-after: always !important;
    }

    @media print {
      .print-content {
        font-size: 14px !important;
      }

      tr,
      th,
      td {
        font-size: 14px !important;
      }

      .title-text {
        font-size: 14px !important;
        font-weight: 600;
      }
    }

    .title-text {
      font-size: 14px;
      font-weight: 600;
      margin-top: 15px;
    }

    .printLeft {
      width: 320px;
    }

    .printCenter {
      width: 160px;
    }

    .printRight {
      width: 300px;
    }

    .left-bottom {
      width: 100%;
      display: flex;
      justify-content: space-between;
    }

    .printTitle {
      margin: 5px 0 10px 0;
      display: flex;
      justify-content: space-around;
      align-items: center;
      width: 600px;
    }

    table {
      border: 1px solid black;
      /* 1px宽，实线，黑色 */
      border-collapse: collapse;
    }

    table td,
    table th {
      border: 1px solid black;
      /* 同样给单元格添加边框 */
    }

    .tablePrint {
      display: flex;
      justify-content: space-between;
      margin-top: 15px;
      flex-flow: row wrap;
    }

    .footerPrint {
      display: flex;
      justify-content: space-around;
      margin-top: 30px;
      color: #000;
    }

    .tableTrtd {
      font-size: 14px;
      white-space: nowrap;
      height: 30px !important;
      text-align: center;
    }

    .textAlign {
      text-align: center !important;
    }
  }
</style>
